Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't this tool script running at all? Nothing works.

Asked by 4 years ago

local plr= game:GetService("Players").LocalPlayer local char = ((character and character.Parent ~= nil and character) or plr.CharacterAdded:wait()) if not char or not char.Parent then character = plr.CharacterAdded:Wait() end local hum= char:WaitForChild("Humanoid") local tool= script.Parent local Left=nil local Right=nil Left = hum:LoadAnimation(script:WaitForChild("Left")) Right = hum:LoadAnimation(script:WaitForChild("Right")) tool.Equipped:connect(function() print"equipped yes" hum.Seated:connect(function(isSeated,seat) if isSeated then if seat:FindFirstChild("Left") then print"oop" Left:Play() elseif seat:FindFirstChild("Right") then print"oop" Right:Play() end else Left:Stop() Right:Stop() end end) end)

I'm trying to make it so once you equip the tool then sit on a seat that has a object "Left", a left animation plays. But nothing seems to be working, any advices??

0
Are there any errors with the script? If not, then put a print statement in the beginning, and after your variables are declared to see what actually is stopping your script from running. OptimisticSide 199 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

It looks this is a local script as you are using hum:LoadAnimation (only works in localscript) and Tool.Equipped only works on a server script, so copy the code for the event (tool.equipped) into a server script and put the script into the tool.

If this is a server script then do the opposite of what I just said.

I hope this helps!

0
Alright got that sorted out, but sure thanks I'll accept answer. TinfoilbotGamer 35 — 4y
Ad

Answer this question