I want to be able to type a command in chat and play an animation continuously just like /dance and /point I want to do that exactly but add more animation
I dont know how to script so I looked on youtube and found a video and used this script in workspace
local DanceAnimation = script:WaitForChild("DanceAnimation") -- make animation object inside script and past animation id in
local Character = player.Character
local AnimationTrack = Character:WaitForChild("Humanoid"):LoadAnimation(DanceAnimation)
AnimationTrack:Play()
Try add next lines in if statement when you playing animation:
local Humanoid = player.Character:WaitForChild("Humanoid")
Humanoid.Running:Connect(function(Speed)
if Speed > 0 then
if AnimationTrack ~= nil then
AnimationTrack:Stop()
end
end
end)
Or you just can stop player from moving until animation stops playing, but this should work.
local command1 = “.dd1”
local command2 = “!lasergun”
function onChatted(chat, recipient, speaker)
local name = speaker.Name
chat = string.lower(chat)
if (chat == command1) then
local player = Players:FindFirstChild(name)
local DanceAnimation = script:WaitForChild(“DanceAnimation”) – make animation object inside script and past animation id in
local Character = player.Character
local AnimationTrack = Character:WaitForChild(“Humanoid”):LoadAnimation(DanceAnimation)
AnimationTrack:Play()
local Humanoid = player.Character:WaitForChild(“Humanoid”)
Humanoid.Running:Connect(function(Speed)
if Speed > 0 then
if AnimationTrack ~= nil then
AnimationTrack:Stop()
end
end
end)
end
if (chat == command2) then
local player = Players:FindFirstChild(name)
game.ServerStorage.Gun:clone().Parent = player:WaitForChild("Backpack")
end
end
function onPlayerEntered(Player)
Player.Chatted:connect(function(chat, recipient) onChatted(chat, recipient, Player) end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
that is what i did now it doesnt play the animation
i just gave it to you becasue i honestly dont know what im doing