I'm trying to make a seat that loads an animation into your character, like a bed with a seat where you lay down instead of sitting.
Here's my script:
local user = script.Parent.User local seat = script.Parent local torso2 = "" function setSitter() local weld = seat:WaitForChild("SeatWeld") if weld.Parent == seat then local torso = weld.Part1 torso2 = weld.Part1.Parent user.Value = torso.Parent local animation = Instance.new("Animation") animation.AnimationId = "rbxassetid://2695673641" local animTrack = torso.Parent.Humanoid:LoadAnimation(animation) animTrack:Play() print("Seat being used") else for _,anim in pairs(game.Workspace[torso2.Name].Humanoid:GetPlayingAnimationTracks()) do anim:Stop() end end end seat.ChildAdded:connect(setSitter) seat.ChildRemoved:connect(setSitter)
Please help!