Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Making an animation activate through chat?

Asked by 7 years ago

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.

0
You didn't set up anything to fire when the player chats. TheeDeathCaster 2368 — 7y

1 answer

Log in to vote
1
Answered by
cabbler 1942 Moderation Voter
7 years ago

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 :)

0
Thanks :) Tybearic 18 — 7y
0
np cabbler 1942 — 7y
0
You cannot get the local player in a server script. Molten_Legacy 40 — 7y
0
He said localscript cabbler 1942 — 7y
Ad

Answer this question