So I'll be honest, this isn't my script. I followed a tutorial on YouTube to make it, it works well however - I can't get the animation to loop. The Animation is self explanatory, it's sleeping, my issue is getting the animation to loop.
Also, if possible, can anyone tell me how I can remove R15 out of the script since it's essentially useless to me?
local seat = script.Parent
local sleepingR15 = seat.SleepingR15
local sleepingR6 = seat.SleepingR6
local sleepAnim
seat.Changed:Connect(function(property)
if property ~= "Occupant" then return end
local occupant = seat.Occupant
if occupant then
local character = occupant.Parent
local humanoid = character.Humanoid
local player = game.Players:GetPlayerFromCharacter(character)
if player and humanoid.RigType == Enum.HumanoidRigType.R15 then
sleepAnim = humanoid:LoadAnimation(sleepingR15)
sleepAnim:Play()
elseif player then
sleepAnim = humanoid:LoadAnimation(sleepingR6)
sleepAnim:Play()
end
elseif sleepAnim then
sleepAnim:Stop()
end
end)

1 comment
Should also note, I'm only wanting the R6 animation to run.