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

How do I start an animation when i click on a tool?

So, i'm trying to start an player animation when I click. I'm new to scripting so i really don't understand what wrong. I've tried using


script.Parent.MouseButton1Down:Connect(Function()
	--some code here i forgot what it was
end) 
 

but that doesn't work. Please help.

5 comments

0

use remote events.

0

sorry for ths spam but this is what i mean

0

@bossshot1234 You do not need to use RemoteEvents for playing animations as you can play animations on the client. | @OP Did you receive any errors in the Output window?

0

yes but it would not show i am pretty sure, since thats only the client?

0

and if he wanted to make something happen with a marker signal he would need a server script.

1 answer

✓ Accepted answer

script.Parent.MouseButton1Down:Connect(function() -- this is in a local script inside of the tool game.Replicated Storage.RemoteEvent:FireServer()-- or whatever the name and the parent end

-- now, in the script in server script service

game.Repstrg.RemotEvent.Onserverevent:Connect(function(player) local anim = -- wherever ur animation is local animator = instance.new("Animator", player.Character.Huamnoid) local track = animator:LoadAnimation(anim)

track:Play()

end

1 comment

0

ahh thats a really messed up layout, but the whole thing is the script

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