local speed = 10
hatchOneConnection = RunService.RenderStepped:Connect(function()
local cf = CFrame.Angles(0,0,math.sin(speed)/2)
eggModel:SetCFrame(cf)
if speed < 60 then
speed += 0.01 * speed
end
end)
I want it to take up 3 seconds(which i do a wait(3) later in the script), but this is the only way I saw how to do it.
I have this run for 3 seconds, then destroy the connection under. Is there a way to coroutine this? I dont know much about coroutines lol but I want this to run beside the stuff beneath it
Not sure how to use coroutines sorry lol
But answering the title:
It runs every frame the player is getting, If the game is running at 40 FPS, then RenderStepped will fire 40 times per second and the step argument will be roughly 1/40th of a second.
Different for every player and players with FPS unlockers will likely be running it way more https://developer.roblox.com/en-us/api-reference/event/RunService/RenderStepped
yeah i know that, but I need it to run alongside what is beneath it which is why i did renderstepped, is there a way to use a while loop coroutined? I dont know much about coroutines.
RenderStepped fires at every frame render on your device.
So if you’re playing on 120 FPS, your speed will go up twice as fast as if you were playing on 60 FPS.
Look into DeltaTime, your RenderStepped passes it as an argument through parameters
what do you mean? do i have to do like coroutine.destroy or something? here is the full code btw
local speed = 10
hatchOneConnection = RunService.RenderStepped:Connect(function()
local cf = CFrame.Angles(0,0,math.sin(speed)/2)
eggModel:SetCFrame(cf)
if speed < 60 then
speed += 0.01 * speed
end
end)
if not bool then wait(3) else wait(1.2) end
TweenService:Create(script.Parent.Parent.EggDisplay:FindFirstChildOfClass("ViewportFrame"),TweenInfo.new(0.5),{ImageTransparency = 1}):Play()
wait(0.5)
hatchOneConnection:Disconnect()
coroutine.wrap(function()
repeat
local cf = CFrame.Angles(0,0,math.sin(speed)/2)
eggModel:SetCFrame(cf)
if speed < 60 then
speed += speedInc * speed
end
task.wait()
until doneEgg
end)
Why doesnt this work? I dont think coroutines print errors