Animation is not running

  1. What do you want to achieve?
    I want to run an animation to player (legacy script)
  2. What is the issue?
    The script works well expect for animation.
  3. What solutions have you tried so far?
    I had a animation.Ended:Wait() and it led to infinite waiting in function.

Animation ID: rbxassetid://17075981181

local bed = workspace.Apartment.Bed
local hitbox = bed.Hitbox
local clickDetector = hitbox.ClickDetector

local anim = game.ReplicatedStorage.Animations.Sleep
local foundAnomaly = game.ReplicatedStorage.GameInformation.FoundAnomaly
local timeG = game.ReplicatedStorage.GameInformation.Time
local tweenService = game:GetService("TweenService")
local updateTime = game.ReplicatedStorage.Events.AdvanceTime

local function AdvanceTime()
	if foundAnomaly.Value == true then
		timeG.Value += 1
	else
		timeG.Value = 1
	end
end
clickDetector.MouseClick:Connect(function(plr)
	local char = plr.Character
	local humanoid = char:FindFirstChildOfClass("Humanoid")
	local darkness = plr.PlayerGui.ScreenGui.Black
	if humanoid then
		char:SetPrimaryPartCFrame(CFrame.new(-11.38, 5.466, 11.215) * CFrame.Angles(0,math.rad(180),0))
		char.PrimaryPart.Anchored = true
		local animation = humanoid.Animator:LoadAnimation(anim)
		local fadeIn = tweenService:Create(darkness, TweenInfo.new(1), {BackgroundTransparency = 0})
		local fadeOut = tweenService:Create(darkness, TweenInfo.new(1), {BackgroundTransparency = 1})
		animation:Play()
		task.wait(3)
		fadeIn:Play()
		fadeIn.Completed:Wait()
		fadeOut:Play()
		spawn(AdvanceTime)
		updateTime:Fire()
                --animation.Ended:Wait()
		char.PrimaryPart.Anchored = false
	end
end)
1 Like

I just find out the host of issue. Game settings had R6 avatar type, animation was made for R15.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.