When I equip it a few times, it decides to rotate my character. Anyone know why this won't work?
Heres the glitch: Video
local tool = script.Parent
function Weld(par)
for _,v in pairs(par:GetChildren()) do
Weld(v)
if v:IsA("BasePart") and v.Name ~= "Handle" then
local weld = Instance.new("Weld", tool)
weld.Part0 = tool.Handle
weld.Part1 = v
weld.C0 = tool.Handle.CFrame:inverse() * tool.Handle.CFrame
weld.C1 = v.CFrame:inverse() * tool.Handle.CFrame
v.Anchored = false
end
end
end
function Unweld(par)
for _,v in pairs(par:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
end
if v:IsA("Weld") then
v:Destroy()
end
end
end
function equipped(mouse)
Weld(tool)
script.Parent.Handle.Anchored = false
end
function unequipped(mouse)
Unweld(tool)
end
script.Parent.Equipped:connect(function(mouse)
Spawn(function() equipped(mouse) end)
end)
script.Parent.Unequipped:connect(function(mouse)
Spawn(function() unequipped(mouse) end)
end)
