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

Making an animation activate through chat?

Hello, I am working on making a dabbing script in my game and I want it to activate through "/e dab. It isn't working and I'm not sure why. It is located in Starter Player Scripts and it's a local script.

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://636749560"
local animtrack = nil
local canplay = true

function processCommand(speaker, message)
	if message == "/e dab" then
		if canplay then
			canplay = false
			local Cname = speaker.Name
			local character = game.Workspace.Cname
			animtrack = character.Humanoid:LoadAnimation(animation)
			animtrack:Play()
		end
	end
end

Any help is appreciated.

1 comment

0

You didn't set up anything to fire when the player chats.

1 answer

✓ Accepted answer

You didn't show the rest of your code but assuming you use a simple .Chatted connection, the function parameters are actually (message,recipient) in that order.

Make sure your AnimationId is correct. If not it should warn you in the output.

Also local character = game.Workspace.Cname is bad practice. You can simply use game.Players.LocalPlayer.Character to get the character :)

4 comments

0

Thanks :)

0

np

0

You cannot get the local player in a server script.

0

He said localscript

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