I got a local script i had add to my animation it was a sit animation as soon as I test the game out i go ahead and tap the buttom in my gui and once i do the animation don’t respond, and it don’t do the animation. anybody do you got any local script that works for me? Cause I need it. and also its a r6 animation.
local player = game.Players.LocalPlayer
local character = player.Character
repeat wait()
character = player.Character
until character
local hum = character:WaitForChild(“Humanoid”)
local emote = hum:LoadAnimation(script.Parent.Emote)
playing = false
script.Parent.MouseButton1Click:Connect(function()
if playing == false then
emote:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
playing = true
elseif playing == true then
emote:Stop()
hum.WalkSpeed = 16
hum.JumpPower = 50
playing = false
end
end)
Oh i was completely wrong i did think because of the sit it was a when you sit you do an animation here is your real answer
function Wave (Player)
local Animation = script:WaitForChild("Animation") -- You need to add your animation part into the script else you will need to change this
local Npc = script.Parent:WaitForChild("Humanoid") -- this need to be your NPC humanoid or a players Humnoid this is currently set to a NPC but you can do localplayer and then get the humanoid or do it with a button
local Dance = Npc:LoadAnimation(Animation)
Dance:Play() -- the animation will play
end
script.Parent.MouseButton1Click:Connect(Wave) -- the animation will play if you press the button
The previous one was for an NPC but use this for an button in a GUI
local Button = script.Parent.Wave.Animation -- Your button
Button.MouseButton1Click:Connect(function(plr)
if plr.Parent:FindFirstChild("Humanoid") then
local Animation = script:WaitForChild("Animation") -- Your animation needs to be inside the script
local Npc = plr.Parent:FindFirstChild("Humanoid")
local Dance = Npc:LoadAnimation(Animation)
Dance:Play()
end
end)
I hope this worked for you if it didn’t then send me a message.
also if you want to stop the animation don’t use :Play() but use :Stop() instead you can also do a wait if you want the animation to play a specific time
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character= player.CharacterAdded:Wait()
end
local hum = character:WaitForChild(“Humanoid”)
local Animator = hum:WaitForChild(“Animator”)
local emote = Animator:LoadAnimation(script.Parent.Emote)
local playing = false
script.Parent.MouseButton1Click:Connect(function()
if not playing then
emote:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
playing = true
elseif playing then
emote:Stop()
hum.WalkSpeed = 16
hum.JumpPower = 50
playing = false
end
end)
I had this problem while doing this project but the only thing I had to do was change the use of the default animation to an action animation let me explain you by means of an image
I was looking at this script and it looks to me it would work but when Ii try it in game it didnt do the animation when I clicked the sit animation on my gui and btw its a r6 animation.
oh okay, the game is on my other account but here the link. my testing game - Roblox and I gave permission. for you to edit the game with me in Roblox studio