Animations events are delay

so i have this issue with animations event on making a cutscene.
i try to search this delay on the events on animations, but i couldn’t find ANY or nothing similar with my problem. i been using a script from other post as a inspiration and using it for making a general cutscene

here the post:

here my script that i made:

local player = game.Players.LocalPlayer
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local npc1 = workspace.CutSceneArea["House Coming"].h
local door = workspace.CutSceneArea["House Coming"].Door
local RunService = game["Run Service"]
local Camera = workspace.Camera
local npc1_Humanoid = npc1:WaitForChild("Humanoid")
local door_Humanoid = door:WaitForChild("Humanoid")
local animtable = {
	animationD = door_Humanoid:LoadAnimation(game.ReplicatedFirst.Animations.HouseComing.Door);
	animation = npc1_Humanoid:LoadAnimation(game.ReplicatedFirst.Animations.HouseComing.Karl);
}

animtable.animationD:Play()
animtable.animation:Play()

player.PlayerGui.Text.Enabled = false
player.PlayerGui.Text.Background.Mind.Visible = false

workspace.CutSceneArea["House Coming"].Model.Hat.Transparency = 1
workspace.CutSceneArea["House Coming"].Model.Hat.Highlight.Enabled = false

workspace.CutSceneArea["House Coming"].Maletin.Transparency = 1
workspace.CutSceneArea["House Coming"].Maletin.Highlight.Enabled = false

local effect = game.Lighting.Color

effect.TintColor = Color3.new(0,0,0)

local function Cinematic ()
	local CinematicsFolder = script:WaitForChild("coming home")

	local CurrentCameraCFrame = workspace.CurrentCamera.CFrame
	local currentfov = workspace.CurrentCamera.FieldOfView

	Camera.CameraType = Enum.CameraType.Scriptable
	local FrameTime = 0
	local fov = 0
	local Connection
	local Connection2
	task.spawn(function()
		animtable.animation:GetMarkerReachedSignal("none"):Connect(function()
			npc1["Meshes/FedoraAccessory"].Handle.Highlight.Enabled = true
			npc1["Meshes/FedoraAccessory"].Handle.Transparency = 0
			npc1.Maletin.Highlight.Enabled = true
			npc1.Maletin.Transparency = 0

			workspace.CutSceneArea["House Coming"].Model.Hat.Transparency = 1
			workspace.CutSceneArea["House Coming"].Model.Hat.Highlight.Enabled = false

			workspace.CutSceneArea["House Coming"].Maletin.Transparency = 1
			workspace.CutSceneArea["House Coming"].Maletin.Highlight.Enabled = false
			print("a")
		end)
		animtable.animation:GetMarkerReachedSignal("Hat"):Connect(function()
			npc1["Meshes/FedoraAccessory"].Handle.Highlight.Enabled = false
			npc1["Meshes/FedoraAccessory"].Handle.Transparency = 1

			workspace.CutSceneArea["House Coming"].Model.Hat.Transparency = 0
			workspace.CutSceneArea["House Coming"].Model.Hat.Highlight.Enabled = true
			print("bruh")
		end)
		animtable.animation:GetMarkerReachedSignal("maletin"):Connect(function()
			npc1.Maletin.Highlight.Enabled = false
			npc1.Maletin.Transparency = 1

			workspace.CutSceneArea["House Coming"].Maletin.Transparency = 0
			workspace.CutSceneArea["House Coming"].Maletin.Highlight.Enabled = true
			print("bruh2")
		end)
		animtable.animation:GetMarkerReachedSignal("damn"):Connect(function()
			player.PlayerGui.Text.Enabled = true
			player.PlayerGui.Text.Background.Karl.Visible = true
			task.spawn(function()
				game.ReplicatedStorage.Karl.Value = "mhhh.."
				task.wait(3)
				game.ReplicatedStorage.Karl.Value = "maybe.."
				task.wait(4)
				game.ReplicatedStorage.Karl.Value = "ill think of it later..."
				task.wait(3)
				effect.TintColor = Color3.new(1,1,1)
				player.PlayerGui.Text.Enabled = false
				player.PlayerGui.Text.Background.Karl.Visible = false
			end)
		end)
		Connection = RunService.RenderStepped:Connect(function(DT)
			local NewDT = DT * 60
			FrameTime += NewDT
			local NeededFrame = CinematicsFolder.Frames:FindFirstChild(tonumber(math.ceil(FrameTime)))
			if NeededFrame then
				char.Humanoid.AutoRotate = false
				Camera.CFrame = npc1.HumanoidRootPart.CFrame * NeededFrame.Value
				if char:WaitForChild("Humanoid").Health <= 1 then
					Connection:Disconnect()
					char.Humanoid.AutoRotate = true
					Camera.CameraType = Enum.CameraType.Custom
					Camera.CFrame = CurrentCameraCFrame	
				end
			else
				Connection:Disconnect()
				char.Humanoid.AutoRotate = true
				Camera.CameraType = Enum.CameraType.Custom
				Camera.CFrame = CurrentCameraCFrame
			end
		end)
		Connection2 = RunService.RenderStepped:Connect(function(DaT)
			if CinematicsFolder.FOV then
				local NewaDT = DaT * 60
				fov += NewaDT
				local neededfov = CinematicsFolder.FOV:FindFirstChild(tonumber(math.ceil(fov)))
				if neededfov then
					if char then
						Camera.FieldOfView = neededfov.Value
					elseif char:WaitForChild("Humanoid").Health <= 1 then
						Camera.FieldOfView = currentfov	
					end
				else
					Connection2:Disconnect()
					Camera.FieldOfView = currentfov
				end
			end
		end)
	end)
end
Cinematic()

so that the thing we want to focus on is the :GetMarkerReachedSignal events and when the animations is playing
and i make sure that everything was alright but im still getting all like delay and not at the same time how i wanted to be. here a video of how is the problem:

1 Like

hello??? :moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai::moyai:

You could try KeyframeReached, it essentially (what its name says) fires everytime once it reached a keyframe:

animatable.animation.KeyframeReached:Connect(function(keyframe) -- this is a string
	if keyframe == "animevent" then
	--code
	elseif keyframe == "animevent2" then
	--code
	-- repeat this for how many animevents you have
	end
end)

what you could do is for every event reached, you could add a timestamp and timeposition the animation to that timestamp like:

task.delay(1,function()
      animation.TimePosition = 1
end)
task.delay(1.25,function()
      animation.TimePosition = 1.25
end)

ook @TheJustTinOne and @yoshicoolTV i will try those methods

ok i just notice something really weird about the animation and timing on the keyframes

(btw @yoshicoolTV your example worked but i think is something else that is causing this and @TheJustTinOne your example is too manual ngl)

so if we compare the same cutscene from in game, and the moon animator:

moon animator (animation editor)


in game

you can see a slide diferences, like the actions where is the events on the animation are faster in the moon animator rather in game, and doesnt take too much keyframes when the like the character stands or do something.

well the footage tell everything so pls, i dont know what is happening but i think is the animation and the script (and i even repload the animation and is still the same)

1 Like