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

What is wrong with my animation script?

If someone says "/e sprinkler" or "/e cabbage", the script checks if they're in a certain group, if they are then they would perform the follow animations. If they aren't then nothing happens.

YourGroupId = "846314"
function onPlayerEntered(newPlayer)

game.Players.PlayerAdded:connect(function(player)
	player.Chatted:connect(function(msg)
		if msg == '/e sprinkler' and newPlayer:IsInGroup(YourGroupId) then
			player.animationID = 149359445
		if msg == '/e cabbage' and  newPlayer:IsInGroup(YourGroupId) then
			player.animationID = 168149515

Thanks

2 comments

0

To me, it appears you forgot the 'end''s for the 'if' statements and functions, ya Silly Billy. :)

0

Adding end doesn't seem to affect the script. Thanks for pointing out anyway!

1 answer

You don't need onPlayerEntered, remove that. Also, when you have the event fire for PlayerAdded, you called the new player "player". On lines 6 and 8 you wrote "newPlayer" instead of "player". Just fix those things, and don't forget to write ends.

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