I'm working on a door transition script that fads a black gui using renderstepped, but it has to fire an event afterwards to teleport a player, but I don't want it to keep doing that.
local doorTransition = game.ReplicatedStorage.Remote.ServerToClient.Event.DoorTransition doorTransition.OnClientEvent:Connect(function(plr) print("Recieved from server") --////Fancy transitioning local runService = game:GetService("RunService") runService.RenderStepped:Connect(function() script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency - 0.025 if script.Parent.BackgroundTransparency <= 0 then end end) end)
It would be best to use what Roblox provides you with. BindToRenderStep and UnbindFromRenderStep.
local runServ = game:GetService("RunService") runServ:BindToRenderStep("test", Enum.RenderPriority.Camera.Value, function() print("ran") end) wait(2) runServ:UnbindFromRenderStep("test")
Hope this helps.
Example from Locard:
local runService = game:GetService('RunService') local Stepped Stepped = runService.Stepped:Connect(function() print('Printing') end) wait(.5) Stepped:Disconnect()