I followed this tutorial, but every time I equip the tool, it gets delete from the inventory after exactly 3 seconds.
It also locks me in the default animation when I launch it.
LocalScript in StarterPlayerScripts (has the same effect as in StarterCharacterScripts)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local torso = character:FindFirstChild("Torso")
local toolMotor = Instance.new("Motor6D")
toolMotor.Name = "ToolMotor"
toolMotor.Part0 = torso
toolMotor.C0 = CFrame.new()
toolMotor.Parent = torso
local function onToolAdded(tool)
if not tool:IsA("Tool") then return end
local bodyAttach = tool:FindFirstChild("BodyAttach")
if not bodyAttach then return end
tool.CanBeDropped = false
toolMotor.Part1 = bodyAttach
bodyAttach.CFrame = torso.CFrame
end
local function onToolRemoved(tool)
if toolMotor.Part1 and tool:IsA("Tool") then
if toolMotor.Part1:IsDescendantOf(tool) then
toolMotor.Part1 = nil
end
end
end
for _, child in ipairs(character:GetChildren()) do
onToolAdded(child)
end
character.ChildAdded:Connect(onToolAdded)
character.ChildRemoved:Connect(onToolRemoved)
Help would be much appreciated!
