So I've been experimenting and I can't find a solution to this problem, can anyone lend me a hand? this is what I have done so far...
script.Parent.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function() animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() game.Lighting:findFirstChild("Tool 1"):clone().Parent = player.Backpack script.Parent:Remove() end) end)
If anyone can help me with this I would be appreciated :)
--Variables local obj = script.Parent local player = game.Players.LocalPlayer local function onActivate() animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() game.Lighting:FindFirstChild("Tool 1"):Clone().Parent = player.Backpack obj:Destroy() end end) obj.Activated:Connect(onActivate)
Many errors in the script. It had a tool cloning to the "player" which was not set up in local. You were using equipped for detecting when a player hits the mousebutton1 which isn't its purpose, instead use Activated. I am not completely sure what this is for but here is what I could help you with.
Have a good day.