Hey guys! I’ve been working on a new game and decided to try to push myself to go farther this time and try animation! I’m a fairly beginner coder, I have some experience but not a lot! so when I made this, I thought it looked really good:
(file was too large, view the video here)
To accomplish this, I used :GetMarkerReachedSignal("Signalname"):Connect(function(Keyframe) which seemed to work out fine in studio, however, when it is played with more than one person, the timing is completely off, and the script doesn’t quite reach the keyframe I want it to to continue the cutscene. I use a callback function to try and align everyone’s client to the same spot, but it doesn’t seem to work.
For the callback function, I call on this function:
function WaitForCallback()
repeat wait()
until
WaitForCallbackBool == true
WaitForCallbackBool = false
end
and then at the end of a cutscene, I have the client fire to the server to make “WaitForCallbackBool” == true:
RE.OnServerEvent:Connect(function(player,Key,Var1)
if Key == "CutsceneEnd" then
WaitForCallbackBool = true
end
end)
Which then continues the core script.
Again, theres slight delays that mess up and ruin the cutscene as follows here
I’ve been stumped on how to make everyone’s cutscene align and it’s kind of ruined my motivation to continue the game, so any help would be amazing at this point!! I wanna see this game through for once!
Thanks so much!
Revelted
EDIT: I should probably also mention what I have currently when it reaches a keyframe:
SciAnimTrack:GetMarkerReachedSignal("PenCamera"):Connect(function(Keyframe)
print(Keyframe)
SciAnimTrack:AdjustSpeed(0)
local CameraFlash = TweenService:Create(ScienceGuy["Meshes/camera (1)"].PointLight,TweenInfo.new(0.2, Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0, true, 0),{Brightness = 10})
CameraFlash:Play()
SoundsFolder.CamFlash:Play()
CameraFlash.Completed:Wait()
wait(1)
SciAnimTrack:AdjustSpeed(1)
wait(5)
RE:FireAllClients("CamMan",workspace.Cam_Science3,true)
WaitForCallbackBool = true
end)
I basically want it to pause the animation RIGHT at a certain point, then play a tween, then continue.