Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I am trying to make an animation script on sit, But the animation won't play?

local plr = game.Players.LocalPlayer
local chr = plr.Character
game.Players.bowypenguino.Character.Humanoid.Sit:connect(function()
local anim1 = Instance.new("Animation")
anim1.AnimationId = "rbxassetid://552786893"
local Anim = chr.Humanoid:LoadAnimation(anim1)
Anim:Play()
end)

That is the script, no errors, but it won't play when I sit!

3 comments

0

Make sure to use a code block so we can read the code properly.

0

How do I do that?

0

There should be a button just above the box where you enter your text. The button is an image of Lua's logo.

1 answer

game.Players.bowypenguino.Character.Humanoid.Sit:connect(function()

This won't work because Sit is a bool.

Make sure this is in a Localscript, too.

plr = game.Players.LocalPlayer -- defines plr
chr = plr.Character -- finds character
chr.Humanoid.Changed:connect(function() -- once a property of humanoid changes, the function is run.
	if chr.Humanoid.Sit == true then -- checks if the player is sitting
		local anim1 = Instance.new("Animation")
		anim1.AnimationId = "rbxassetid://552786893"
		local Anim = chr.Humanoid:LoadAnimation(anim1)
		Anim:Play()
	end
end)

1 comment

0

Your script is great, but the animation doesn't play.

This discussion is preserved as it was. New answers, comments, and votes are closed.