Hi this is my first post on the devforum
I made a little local script that supposed to be a round system for my game
but it doesn’t work
Here is my code
local Time = game.ReplicatedStorage.Time
local timeText = game.ReplicatedStorage.TimerText
local textLabel = game.StarterGui.ScreenGui.TextLabel
local player = game.Players.LocalPlayer
Time.Value = 30
while true do
wait(1)
for i = Time, 0, -1 do
timeText.Value = "game starts in "..i.."s"
textLabel.Text = Time.Value
if Time.Value == 0 then
player.Character.PrimaryPart.Position = game.Workspace.Part.Position
textLabel.Visible = false
break
end
end
end
I tried everything please help
Also it Shows an error in the output
Workspace.LordBoboux.RoundSystem:6: invalid ‘for’ initial value (number expected, got Instance)
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
timeText.Value = "game starts in "..i.."s"
textLabel.Text = i
if Time.Value == 0 then
player.Character.PrimaryPart.Position = game.Workspace.Part.Position
textLabel.Visible = false
break
end
end
end
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
timeText.Value= i
textLabel.Text = "game starts in "..i.."s"
if Time.Value == 0 then
player.Character.PrimaryPart.Position = game.Workspace.Part.Position
textLabel.Visible = false
break
end
end
end
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")
while true do
task.wait(1)
for i = 30, 0, -1 do
timeText.Value= i
textLabel.Text = "game starts in "..i.."s"
if Time.Value == 0 then
player.Character.PrimaryPart.Position = game.Workspace.Part.Position
textLabel.Visible = false
break
end
task.wait()
end
end
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")
while true do
task.wait(1)
for i = 30, 0, -1 do
print("done") -- print?
timeText.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
end
end