So I have scripts in my game that have's the client send over the fps every second to the server but it doesn't seem to work local script parent : replicatedfirst script parent : serverscriptservice local script :
01 | local player = game.Players.LocalPlayer |
02 | local rstorage = game:GetService( "ReplicatedStorage" ) |
03 | local event = rstorage:WaitForChild( "Event" ) |
04 | local RunService = game:GetService( "RunService" ) |
05 | local TimeFunction = RunService:IsRunning() and time or os.clock |
06 | local LastIteration, Start |
07 | local FrameUpdateTable = { } |
08 | local function HeartbeatUpdate() |
09 | LastIteration = TimeFunction() |
10 | for Index = #FrameUpdateTable, 1 , - 1 do |
11 | FrameUpdateTable [ Index + 1 ] = FrameUpdateTable [ Index ] > = LastIteration - 1 and FrameUpdateTable [ Index ] or nil |
12 | end |
13 | FrameUpdateTable [ 1 ] = LastIteration |
14 | local fps = tostring (math.floor(TimeFunction() - Start > = 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start))) .. " FPS" |
15 | Start = TimeFunction() |
script :
1 | local rstorage = game:GetService( "ReplicatedStorage" ) |
2 | local event = rstorage:WaitForChild( "Event" ) |
3 | event.OnServerEvent:Connect( function (player,fps) |
4 | player.Character.Head.BillboardGui.Frame.Time.Text = tostring (fps) |
5 | end ) |
If someone could help I would appreciate it a lot!
Try changing your line 5 to
1 | local TimeFunction = RunService:IsRunning() and time or os.clock() |
well, if you want to debug it, put print("what line your on") after every line and see whats wrong, or just press the go to script error button, it sucks i know, but you gotta do it