You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
The timer script works perfectly in testing, it even works when I test with more than one player. -
What is the issue?
Now that the game is live, I invite folks in to play but then the timer breaks and doesn’t work -
What solutions have you tried so far?
I don’t know what to do ? Honestly if it worked in test mode over and over again with one player and with more than one player it should work when live but it is breaking ? It seems to break when other players are joining in. They should be able to join and wait in the lobby until the next round starts. Which has successfully happened, but then after the round the timer appears to get stuck. Its very disappointing.
local lobby_Duration = 20
local round_Duration = 200
local map_Fol = game.ReplicatedStorage:WaitForChild("Map")
local timerval = game.ReplicatedStorage:WaitForChild("TimerValue")
local function RTimer ()
while wait() do
for l = lobby_Duration, 0, -1 do
timerval.Value = 'Intermission: '..l
wait(1)
if l == 0 then
--local map = map_Fol:WaitForChild('Main') -- change to your map name
local mapCopy = map_Fol:Clone()
mapCopy.Name = "mapCopy"
mapCopy.Parent = game.Workspace
timerval.Value = 'Teleporting players to '..mapCopy.Name
wait(1)
mapCopy.Parent = workspace
wait(2)
local plrs = game.Players:GetChildren()
for i = 1, #plrs do
plrs[i].Character:MoveTo(Vector3.new(-15.254, 6.232, 130.566))
end
local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("DisplayRole")
local Sword = ReplicatedStorage:WaitForChild("Sword")
local Killer = nil
local Survivors = {}
function pickPlayers()
if Killer then
if Players:FindFirstChild(Killer) then
if Players[Killer].Bakcpack:FindFirstChild(Sword.Name) then
Players[Killer].Bakcpack[Sword.Name]:Destroy()
else
if Workspace:FindFirstChild(Killer) then
if Workspace[Killer]:FindFirstChild(Sword.Name) then
Workspace[Killer][Sword.Name]:Destroy()
end
end
end
end
end
Killer = nil
Survivors = {}
local PlayersGroup = Players:GetChildren()
local KillerID = math.random(1, #PlayersGroup)
for i, v in pairs(PlayersGroup) do
if i == KillerID then
Killer = v.Name
break
end
end
for i, v in pairs(PlayersGroup) do
if i == KillerID then
else
table.insert(Survivors, v.Name)
end
end
Event:FireClient(Players[Killer], "You are Killer")
Sword:Clone().Parent = Players[Killer].Backpack
print("Killer: ".. Killer)
for i, v in pairs(Survivors) do
Event:FireClient(Players[v], "You are Survivor")
print("Survivor: ".. v)
end
end
pickPlayers()
wait(1)
for g = round_Duration,0, -1 do
timerval.Value = 'Round '..g..' seconds left'
wait(1)
if g == 0 then
timerval.Value = 'Round over'
wait(2)
local function cleanup()
game.Workspace.mapCopy:Destroy()
end
cleanup()
timerval.Value = 'Teleporting players to lobby'
wait(1)
for i = 1, #plrs do
plrs[i].Character:MoveTo(Vector3.new(1097.553, -36.89, -26.611))
end
--map.Parent = map_Fol
wait(1)
-- repeat again
end
end
end
end
end
end
spawn(RTimer)