-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhat holder.lua
81 lines (68 loc) · 1.85 KB
/
hat holder.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local lp = game.Players.LocalPlayer
local char = lp.Character
for i, v in pairs(char:GetChildren()) do
if v:IsA("BallSocketConstraint") then
v:Destroy()
end
end
for i, v in pairs(char:GetChildren()) do
if v:IsA("HingeConstraint") then
v:Destroy()
end
end
for i, v in pairs(char.Humanoid:GetAccessories()) do
local hat = v.Name
char[hat].Archivable = true
local fake = char[hat]:Clone()
fake.Parent = char
fake.Handle.Transparency = 1
local hold = false
local enabled = false
char[hat].Handle.AccessoryWeld:Destroy()
local tool = Instance.new("Tool", lp.Backpack)
tool.RequiresHandle = true
tool.CanBeDropped = false
tool.Name = hat
local handle = Instance.new("Part", tool)
handle.Name = "Handle"
handle.Size = Vector3.new(1, 1, 1)
handle.Massless = true
handle.Transparency = 1
local positions = {
forward = tool.GripForward,
pos = tool.GripPos,
right = tool.GripRight,
up = tool.GripUp
}
tool.Equipped:connect(function()
hold = true
end)
tool.Unequipped:connect(function()
hold = false
end)
tool.Activated:connect(function()
if enabled == false then
enabled = true
tool.GripForward = Vector3.new(-0.976,0,-0.217)
tool.GripPos = Vector3.new(.95,-0.76,1.4)
tool.GripRight = Vector3.new(0.217,0, 0.976)
tool.GripUp = Vector3.new(0,1,0)
wait(.8)
tool.GripForward = positions.forward
tool.GripPos = positions.pos
tool.GripRight = positions.right
tool.GripUp = positions.up
enabled = false
end
end)
game:GetService("RunService").Heartbeat:connect(function()
pcall(function()
char[hat].Handle.Velocity = Vector3.new(30, 0, 0)
if hold == false then
char[hat].Handle.CFrame = fake.Handle.CFrame
elseif hold == true then
char[hat].Handle.CFrame = handle.CFrame
end
end)
end)
end