Hey there I know that this may seem simple to a lot of you but for some reason despite being an average coder i can't do this right now.

I have this animation played on click but i don't know how to stop the anim if the player sits down I tried a few things like while loops and if statements i just don't know what to do please help :) Btw the script and anim are children of a button gui.


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
	  if game.Players.LocalPlayer.Character.Humanoid.Sit == false then
		emote:Play()
		hum.WalkSpeed = 9
		hum.JumpPower = 0
		playing = true
	  end
	elseif playing == true then
		emote:Stop()
		hum.WalkSpeed = 16
		hum.JumpPower = 50
		playing = false
	end
end)

2 comments

0

Thanks JesseSong I never knew that Humanoid.Seated was something you could do :)