In this script
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local roundLength = 15
local intermissionLength = 5
local InRound = ReplicatedStorage:WaitForChild("InRound")
local Lobby = game.Workspace.Map.MainSpawn.PositionMain
InRound.Value = false
local Status = ReplicatedStorage:WaitForChild("Status")
local TeamRed = Teams:FindFirstChild("TeamRed")
local TeamBlue = Teams:FindFirstChild("TeamBlue")
local Neutral = Teams:FindFirstChild("Neutral")
local RedSpawn = game.Workspace.Map.TeamSpawns.TeamRedSpawnFolder.TeamRedSpawn
local BlueSpawn = game.Workspace.Map.TeamSpawns.TeamBlueSpawnFolder.TeamBlueSpawn
InRound.Changed:Connect(function()
if InRound.Value == false then
print("Player can change teams")
for _, player in ipairs(game.Players:GetPlayers()) do
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local team = player.Team
if team and (team == TeamBlue or team == TeamRed) then
humanoidRootPart.CFrame = Lobby.CFrame
end
end
end
elseif InRound.Value == true then
for _, player in ipairs(game.Players:GetPlayers()) do
wait(1)
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local team = player.Team
if team and team == TeamBlue then
humanoidRootPart.CFrame = BlueSpawn.CFrame
elseif team and team == TeamRed then
humanoidRootPart.CFrame = RedSpawn.CFrame
end
end
end
end
end)
local function RoundTimer()
while wait() do
for i = intermissionLength, 1, -1 do
InRound.Value = false
wait(1)
Status.Value = "Intermission: " .. i .. " seconds left..."
end
for i = roundLength, 1, -1 do
InRound.Value = true
wait(1)
Status.Value = "Game: " .. i .. " seconds left... "
end
end
end
spawn(RoundTimer)
game.ReplicatedStorage.ChangeTimeValue.OnServerEvent:Connect(function(player)
if player:IsA("Player") then
roundLength = roundLength + 100
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if InRound.Value == false then
game.StarterPlayer.CameraMaxZoomDistance = 128
character:WaitForChild("HumanoidRootPart").CFrame = Lobby.CFrame
end
end)
InRound.Changed:Connect(function(newValue)
wait(1) -- Wait for the next frame to allow the team assignment to update
if newValue == true then
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
local team = player.Team
if team and team == TeamBlue then
humanoidRootPart.CFrame = BlueSpawn.CFrame
game.StarterPlayer.CameraMaxZoomDistance = 1
elseif team and team == TeamRed then
humanoidRootPart.CFrame = RedSpawn.CFrame
game.StarterPlayer.CameraMaxZoomDistance = 1
end
end
else
-- Player is no longer in the round, kill the player
local humanoid = player.Character and player.Character:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = 0
end
end
end)
end)
(I used TDK’s script.)
Here if the Inround.value is false Cash.value = + 150 and will create a message for the player by Message saying “Rewarded 150.”.
I wrote one and added it as a child of the round system handler above.
local Teams = game:GetService("Teams")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local InRound = ReplicatedStorage:WaitForChild("InRound")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local function RewardPlayer()
if InRound.Value == false then
wait(1)
while true do
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local Cash = leaderstats:FindFirstChild("Cash")
if Cash then
-- Check if the player is on a team
if player.Team then
local playerTeam = player.Team
if playerTeam ~= Teams.TeamRed and playerTeam ~= Teams.TeamBlue then
-- Reward the player with cash
Cash.Value = Cash.Value + 150
-- Display reward message in the player's chat
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
Text = "Rewarded 150 CASH.";
Color = Color3.new(1, 1, 0); -- Yellow color
})
else
-- Display warning message in the player's chat
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", {
Text = "You did NOT join a team.";
Color = Color3.new(1, 0, 0); -- Red color
})
end
else
warn("Player is not on a team.")
end
else
warn("Can't find the Cash value!")
end
else
warn("Can't find the leaderstats folder!")
end
end
end
end
return RewardPlayer