I’m sure some of you are familiar with “vibe game”. I’m trying to do that but instead of playing the animation by sitting, I want it to play when a person equips a tool while they are sitting.
Side question: It is possible to randomize the animation? What I mean by this is when a player sit in a chair it won’t play the same animation when they sit in the same chair again.
Thank you in advance :>
2 Likes
This should work
Put in a local script in the tool
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local anim = player.Character.Humanoid:LoadAnimation(script.Parent.SitAnim)
script.Parent.Equipped:Connect(function()
if player.Character.Humanoid.Sit == true then
anim:Play()
end
end)
script.Parent.Unequipped:Connect(function()
anim:Stop()
end)
1 Like
What @Zombiefin did should work.
You can randomize the Animation played by doing something like this
local Animations = { Anim1, Anim2, Anim3, Anim4}
local CurrentAnim
Tool.Equipped:Connect(function()
CurrentAnim = Animations[math.random(1, #Animations)]
CurrentAnim:Play()
end)
Tool.Uneqipped:Connect(function()
CurrentAnim:Stop()
end)
1 Like