How do i run a while loop checking for a true value if the value starts of as false

hey all,

I was running my fuel system on my local script before I completely re-wrote my planekit. This did not carry over well when I re-wrote it because it was running on renderstepped, which I have no idea what is (but it worked and that’s what counts), but does not exist on server script. So now this does not work because the if Active == true then will just check once.

To get around this I tried a while Active == true do but this does not catch because the plane starts off as Active == false and so the loop wouldn’t catch it.

What is the equivalent to renderstepped for serverscripts? I think this will solve my problem, not sure what the api is, though.

runservice.RenderStepped:connect(function()
	local adb = false
	if Active == true then
		if not adb then
			adb = true
			fuelsender()
			adb = false
		end
	end
end)

Thanks!

While true do
if Active then
— Do stuff
end
wait()
end

On the server you can use Stepped or Heartbeat

1 Like