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 :
local player = game.Players.LocalPlayer local rstorage = game:GetService("ReplicatedStorage") local event = rstorage:WaitForChild("Event") local RunService = game:GetService("RunService") local TimeFunction = RunService:IsRunning() and time or os.clock local LastIteration, Start local FrameUpdateTable = {} local function HeartbeatUpdate() LastIteration = TimeFunction() for Index = #FrameUpdateTable, 1, -1 do FrameUpdateTable[Index + 1] = FrameUpdateTable[Index] >= LastIteration - 1 and FrameUpdateTable[Index] or nil end FrameUpdateTable[1] = LastIteration local fps = tostring(math.floor(TimeFunction() - Start >= 1 and #FrameUpdateTable or #FrameUpdateTable / (TimeFunction() - Start))) .. " FPS" Start = TimeFunction() RunService.Heartbeat:Connect(HeartbeatUpdate) while wait(1) do event:FireServer(player,fps) end end
script :
local rstorage = game:GetService("ReplicatedStorage") local event = rstorage:WaitForChild("Event") event.OnServerEvent:Connect(function(player,fps) player.Character.Head.BillboardGui.Frame.Time.Text = tostring(fps) end)
If someone could help I would appreciate it a lot!
Try changing your line 5 to
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