EDIT : Some of my scripts have worked on this, but they were too laggy (0.1 fps) Okay, i was making a game where there's a timer and leaderboard , with a start / end point This is my local script, parent of the timer gui
--a = 0
local RS = game:GetService('RunService')
--RS:BindToRenderStep('',1,function()
--a = a + 1
--b = a / 60
--script.Parent.Text = b
--end)
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(a)
local starttime = workspace.DistributedGameTime
while true do
wait()
local time = workspace.DistributedGameTime - starttime
script.Parent.Text = time
end
local seconds = script.Parent.Parent.Time
script.Parent.Text = seconds.Value
game.ReplicatedStorage.End.OnClientEvent:Connect(function(a)
local starttime = workspace.DistributedGameTime
tim = time
game.ReplicatedStorage.Submit:FireServer(plr, starttime, workspace.DistributedGameTime, tim)
end
)end)
This is my start brick script, parented to a part
function deathTouch(part)
game:GetService("Players")
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
plr.Character.Humanoid.WalkSpeed = 0
plr.PlayerGui.ScreenGui.TextLabel.Text = "0"
wait(0.1)
plr.Character:MoveTo(Vector3.new(0,0,0))
wait(0.1)
plr.Character:MoveTo(Vector3.new(0,0,0))
wait (0.8)
game.ReplicatedStorage.RemoteEvent:FireClient(plr)
plr.Character.Humanoid.WalkSpeed = 16
end
script.Parent.Touched:connect(deathTouch)
This is my end part, when you touch it the timer ends
function deathTouch(part)
game:GetService("Players")
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
game.ReplicatedStorage.End:FireClient(plr)
end
script.Parent.Touched:connect(deathTouch)
This is my script in server script service
game.ReplicatedStorage.Submit.OnServerEvent:Connect(function(plr, submittime, endtime, tim)
print(plr .. submittime .. endtime .. tim)
end)
Remote Events Used : Submit, RemoteEvent, End
Main problem So the problem is the starting brick works, but when I touch the end brick the timer is still stuck in the timer while loop state, i've tried many solutions, any help? (dont ask whats the error there is none) Other problems The timer is slightly inaccurate, i've tried using run service but I am a noob at that and didn't use it Why was this created? A map with a leaderboard and players with the fastest times will be put on leaderboard

1 comment
It´s a loop that detects if something is TRUE. So change that something to false...