Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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


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??

1 comment

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.

1 answer

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!

1 comment

0

Alright got that sorted out, but sure thanks I'll accept answer.

This discussion is preserved as it was. New answers, comments, and votes are closed.