Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

My remote event script has errors but doesnt show them?

Asked by
3F1VE 257 Moderation Voter
3 years ago

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!

0
FYI time is just a placeholder 3F1VE 257 — 3y

2 answers

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

Try changing your line 5 to

local TimeFunction = RunService:IsRunning() and time or os.clock() 
Ad
Log in to vote
0
Answered by 3 years ago

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

Answer this question