local SS = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local val = SS:WaitForChild("Timer")
local random = SS:WaitForChild("Random")
local intermtimer = SS:WaitForChild("IntermissionTimer")
local function updateTimerForAllPlayers(timerValue, isRed)
for _, player in pairs(Players:GetPlayers()) do
if player.PlayerGui:FindFirstChild("TimerGui") then
local timerGui = player.PlayerGui.TimerGui.Timer.Timer
timerGui.Text = timerValue
if isRed then
timerGui.TextColor3 = Color3.fromRGB(255, 0, 0)
else
timerGui.TextColor3 = Color3.fromRGB(255, 255, 255)
end
end
end
end
local function teleportAllPlayers(portalName)
for _, player in pairs(Players:GetPlayers()) do
local character = game.Workspace:FindFirstChild(player.Name)
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local portal = game.Workspace:FindFirstChild(portalName)
if humanoidRootPart and portal then
humanoidRootPart.CFrame = CFrame.new(portal.Position.X, portal.Position.Y, portal.Position.Z)
end
end
end
end
while true do
random.Value = math.random(1, 2)
print(random.Value)
if val.Value <= 0 then
updateTimerForAllPlayers("Intermission", false)
for _, player in pairs(Players:GetPlayers()) do
local character = game.Workspace:FindFirstChild(player.Name)
if character and character:FindFirstChild("Humanoid") then
character.Humanoid.Health = 100
end
end
intermtimer.Value = 30
repeat
updateTimerForAllPlayers("Intermission", false)
intermtimer.Value = intermtimer.Value - 1
task.wait(1)
until intermtimer.Value <= 0
val.Value = 180
end
if random.Value == 1 then
teleportAllPlayers("Location1Spawn")
repeat
val.Value = val.Value - 1
updateTimerForAllPlayers(val.Value, false)
task.wait(1)
until val.Value == 11
repeat
val.Value = val.Value - 1
updateTimerForAllPlayers(val.Value, true)
task.wait(1)
until val.Value <= 0
teleportAllPlayers("tppos1")
end
task.wait(1)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
end)
end)
Вот скрипт:
game.Players.PlayerAdded:Connect(function(plr)
local SS = game:GetService("ServerStorage")
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
local val = SS:WaitForChild("Timer")
local random = SS:WaitForChild("Random")
local intermtimer = SS:WaitForChild("IntermissionTimer")
random.Value = math.random(1,2)
print(random.Value)
while true do
if val.Value == 0 then
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
timer.TextColor3 = Color3.fromRGB(255, 255, 255)
game.Workspace:FindFirstChild( plr.Name ):FindFirstChild("Humanoid").Health = 100
timer.Text = "Intermission"
repeat
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
timer.Text = "Intermission"
intermtimer.Value = intermtimer.Value - 1
task.wait(1)
until intermtimer.Value == 0
val.Value = 180
end
if random.Value == 1 then
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
local port_name = "Location1Spawn"
local portal = game.Workspace:FindFirstChild(port_name)
local humanoidRootPart = game.Workspace:FindFirstChild( plr.Name ):FindFirstChild("HumanoidRootPart")
humanoidRootPart.CFrame = CFrame.new (portal.Position.X ,portal.Position.Y,portal.Position.Z)
repeat
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
val.Value = val.Value - 1
timer.Text = val.Value
task.wait(1)
until val.Value == 11
timer.TextColor3 = Color3.fromRGB(255, 0, 0)
repeat
local timer = plr.PlayerGui:WaitForChild("TimerGui"):WaitForChild("Timer"):WaitForChild("Timer")
val.Value = val.Value - 1
timer.Text = val.Value
task.wait(1)
until val.Value <= 0
local portal_name = "tppos1"
local portal = game.Workspace:FindFirstChild(portal_name)
local humanoidRootPart = game.Workspace:FindFirstChild( plr.Name ):FindFirstChild("HumanoidRootPart")
humanoidRootPart.CFrame = CFrame.new (portal.Position.X ,portal.Position.Y,portal.Position.Z)
intermtimer.Value = 30
random.Value = math.random(1,2)
print(random.Value)
end
end)