#i need help making a script

1 messages · Page 1 of 1 (latest)

tacit frigate
#

can someone please help me make a script of where so if i kill someone, i gain +1 fps

violet juniper
#

Putting the loop in pre-render should work

#

And you can use os.clock() to get precise times

tacit frigate
ebon path
#

or you could use brain power and think of a way to do it, but limiting fps is very advanced

tacit frigate
violet juniper
# ebon path or you could use brain power and think of a way to do it, but limiting fps is ve...

but limiting fps is very advanced
no its literally just

local RunService = game:GetService("RunService")
local MAX_FPS = 10
local frame_start = 0
RunService.PreRender:Connect(function()
  frame_start = os.clock()
end)
RunService.Heartbeat:Connect(function()
  while os.clock() - frame_start < 1/MAX_FPS do end
end)

technically if our heartbeat event is called early, before most of the game logic, then it could end up waiting a little too long but it should be accurate enough for this.

ebon path
#

interesting

#

thanks for the info

ebon path
#

it's pretty different from "how do I create a part within a script"