I have this system that is supposed to print in the output (because it’s not done yet) how long it took to reach the ‘end’ block. I have a variable that will repeatedly add 1 (for counting the seconds) per second. After that, I have a remote function that turns on the debounce so it supposedly stops the counting. Then it’s supposed to set an int value to the variable then print the value. The problem is that it always prints 0. The game file is here:
Speedrunners (ALPHA).rbxl (30.9 KB)
The script running to fire the remote event:
script.Parent.Touched:Connect(function(winner)
if game.ReplicatedStorage.GameEnd.WinDebounce.Value == not true then
game.ReplicatedStorage.GameEnd.WinDebounce.Value = true
local character = winner:FindFirstAncestorWhichIsA("Model")
local playerService = game:GetService("Players")
local player = playerService:GetPlayerFromCharacter(character)
character.PrimaryPart.Position = workspace.SpawnLocation.Position
game.ReplicatedStorage.GameEnd:FireClient(player)
end
end)
The script in Starter Character (Will try putting in player) Scripts running the remote event:
local timeCheck = 0
local boolCheck = game.ReplicatedStorage["Start Game"].StartCharacterCheck.Value
game.ReplicatedStorage["Start Game"].OnClientEvent:Connect(function()
boolCheck = true
boolCheck = not boolCheck
timeCheck = 0
repeat until boolCheck do
timeCheck += 1
task.wait(1)
end
end)
game.ReplicatedStorage.GameEnd.OnClientEvent:Connect(function()
boolCheck = true
game.ReplicatedStorage.TweenOpeningGUI:WaitForChild("SecondsTaken").Value = timeCheck
print(game.ReplicatedStorage.TweenOpeningGUI.SecondsTaken.Value)
game.ReplicatedStorage.TweenOpeningGUI:FireServer(game.Players.LocalPlayer)
end)
If you find a solution, please reply as soon as possible. Thanks.
-NeoGaming_RBLX
EDIT: After changing the repeat until to a while loop like this:
while not boolCheck do
The variable changing went SUPER FAST. I tried turning task.wait to a simple wait but still didn’t work.
