I need help Animation Script

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.

heres the video I recorded from the roblox recorder
robloxapp-20210308-1014463.wmv (591.3 KB)

ij

also here the local script

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)

3 Likes

I have no idea if your scripts are broken or if your animation is broken. Can you send the .rbxlx file for inspection?

1 Like

okay I just edit the topic and there go the script

Can you send the .rbxlx file itself instead of sending the script

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

Try this one which i made.

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)

Don’t use local scripts for animations aaahhh!!! Noooooo!!

What do you mean? What is wrong with loading and playing animations on the client?

1 Like

how do i send the rbxlx file for you to see?

but people use local script for r6 animation and I have a r6 animation

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

and when I did this I published the animation I tried it again with my script and it worked

make sure to change that I hope it has helped you :slight_smile:

can you send me a script because Im using a r6 animation

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.

Is the game a group game or your game and is the animation your own animation or like a group animation?

Can you show me what the output says when you click the button?

well the game says its made by me not my group and its a animsaves animation

can you edit the game and fix it for me in studio?

Alright i can do that just send the link of game to me.

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

just let me know when you in.