Hey Developers!
I was making a timer script for my story game lobby! But I noticed that it wasn’t working…
I am not getting any errors, but the output isn’t printing anything!
Here is my script:
--Variables
local Bus = game.Workspace:WaitForChild('Bus')
local Seats = Bus.Seats
local Hitbox = game.Workspace:WaitForChild('Hitbox')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local TeleportService = game:GetService('TeleportService')
local ServerStorage = game:GetService('ServerStorage')
local Status = ReplicatedStorage:WaitForChild('Status')
local UI = ServerStorage:WaitForChild('ExitGui')
local MinimumPlayers = 3
local Players = 0
local Time = 30
local Teleporting = false
local BusTable = {}
Hitbox.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') and Teleporting == false then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if table.find(BusTable, Player) == nil then
for _, seat in pairs(Seats:GetChildren()) do
if seat.Occupant == nil then
table.insert(BusTable, Player)
local Humanoid = Player.Character.Humanoid
Humanoid.JumpPower = 0
seat:Sit(Humanoid)
UI:Clone().Parent = Player.PlayerGui
break
end
end
end
end
end)
ReplicatedStorage.LeaveBus.OnServerEvent:Connect(function(Player)
local ReturnValue = table.find(BusTable, Player)
table.remove(BusTable, ReturnValue)
Player:LoadCharacter()
Player.Character:WaitForChild('HumanoidRootPart').CFrame = game.Workspace.Setback.CFrame
end)
while true do
wait()
for i = 1, Time, -1 do
print(i)
wait(1)
end
end
Thanks for any help!
I am trying to make a timer countdown, but it isn’t even printing the time!