You could use the Player.Chatted event on game.Players.LocalPlayer, and see if the message is something like “/e dance69”, then load & play an animation on the character’s animator.
An example of this (LocalScript in StarterGui/StarterCharacterScripts):
Code
local player = game.Players.LocalPlayer
-- Get the character, humanoid, and the animator to load the animations
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild('Humanoid')
local animator = humanoid:WaitForChild('Animator')
player.Chatted:Connect(function(msg)
if msg == '/e dance69' then
-- Load the animation and play it
local animation = animator:LoadAnimation(script.edance69)
animation:Play()
-- Optionally, stop it when the character moves
local moveConnection =
humanoid:GetPropertyChangedSignal('MoveDirection'):Connect(function()
moveConnection:Disconnect() -- Stop detecting movement
animation:Stop()
end)
end
end)
-- There are many ways to do this, but I think this is probably the easiest & fastest.