The value instantly changes from 30 to 0 and my camera gets gltchy too
it gets teleported but my character stays at spawn location
add a task.wait at the bottom of the for loop
, and put a number u want
local Time = game:GetService("ReplicatedStorage"):WaitForChild("Time")
local player = game:GetService("Players").LocalPlayer
local timeText = game:GetService("ReplicatedStorage"):WaitForChild("TimerText")
local textLabel = player:WaitForChild("PlayerGui"):WaitForChild("ScreenGui"):WaitForChild("TextLabel")
Time.Value = 30
while true do
task.wait(1)
for i = Time.Value, 0, -1 do
print("done") -- print?
Time.Value= i
textLabel.Text = "game starts in "..i.."s"
print(timeText.Value) -- print?
if Time.Value == 0 then
print("done") -- print?
player.Character.PrimaryPart.Position = game.Workspace.Part.Position
textLabel.Visible = false
break
end
task.wait(3) -- change 3 to desired number
end
end
Mind sharing a video of it? it could help
IT WORKS IT DOES COUNT DOWN AND SHOW THE GUI
but my camera still glitchy
i will send a video in a second
glad to hear.
I tested it. It’s because it’s under a while loop
. So it keeps teleporting you.
wait i don’t know how to send a video
Yes, it’s because of this.
First try it without a while loop.
Second, you could make a variable, something like this -
local Time = game:GetService("ReplicatedStorage"):WaitForChild("Time")
local player = game:GetService("Players").LocalPlayer
local timeText = game:GetService("ReplicatedStorage"):WaitForChild("TimerText")
Time.Value = 14
local inround = false
while inround == false do
task.wait(1)
for i = Time.Value, 0, -1 do
print("done") -- print?
Time.Value= i
print(Time.Value) -- print?
if Time.Value == 0 then
inround = true
print("done") -- print?
player.Character:PivotTo(game.Workspace.Part.CFrame)
break
end
task.wait(1.2) -- change 3 to desired number
end
end
This would run once, if you want to run it more, you’d have to set inround
to false somewhere else when needed.
Nope that script doesn’t work it doesn’t count down nor it shows gui
It does work for me tho.
You might need to do a little adjustment .
Nah im too lazy i will keep the old script
Sure, keep what works for you.
But use this -
player.Character:PivotTo(game.Workspace.Part.CFrame)
to teleport you.
Plus, make sure to have any debounce to prevent from it teleport you constantly.
This a total invalid way for making a round system, no one would start the timer each second, you should make a remote event, and once it gets fired, you need to do the timer
Now your doing the loop every second, thats makes no sense, even if you made it correct, that’s not gonna work as your requirement
I believe he’s doing that like that to test some stuff before diving into the real thing.
ok i will also do that too and some more adjustments
Maybe
But even though he is doing to test some stutf, it wont work, also you won’t run a timer each second tho
I don’t know how to work with remote events im still very new to scripting
There are many tutorials on it, even on youtube. You can always try to check them out
But the principle is:
-Have a timer value inside replicated.
-Have a script on server side, do the countdown from there.
-Update the gui using .Changed
event on the value.
-Use remotes when needed
Yea i will check many tutorials