i made a round system for my fps game and it seems to not work no errors too
the problems are:
- the tool equip is acting kinda weird and its putting the tool on my backpack but its not removing after round ends
- the player not tp to map
the script
local status = game:GetService("ReplicatedStorage"):FindFirstChild("Status")
local maps = game.Workspace.Maps:GetChildren()
local playerneeded = 1
local interTime = 5 --Intermission Time
local roundTime = 10
while true do wait()
for i,v in pairs(game.Players:GetPlayers()) do
if i >= playerneeded then
while true do --intermission loop
status.Value = "Intermission "..interTime
interTime = interTime - 1
wait(1)
if interTime <= 0 then
break
end
end
status.Value = "Round Starting.."
local chosenMapNumber = math.random(1,#maps)--picks a random map
local chosenMap = maps[chosenMapNumber]
local TpRed = chosenMap.Spawns.RedSpawns:GetChildren()
local TpBlue = chosenMap.Spawns.BlueSpawns:GetChildren()
for i, player in pairs(game.Players:GetChildren()) do
player.CharacterAdded:Connect(function(char)
local tools = game.ServerStorage.Tools:GetChildren()
local randomtool = tools[math.random(1,#tools)]
randomtool:Clone().Parent =player.Backpack
player.Character:WaitForChild("Humanoid"):EquipTool(randomtool)
end)
if player.TeamColor == "Really Red" then
local char = player.Character
char.HumanoidRootPart.CFrame = TpRed[math.random(1,#TpRed)].CFrame * CFrame.new(0,3,0)
end
if player.TeamColor == "Really Blue" then
local char = player.Character
char.HumanoidRootPart.CFrame = TpBlue[math.random(1,#TpBlue)].CFrame * CFrame.new(0,3,0)
end
end
while true do --round loop
status.Value = "Round "..roundTime
roundTime = roundTime - 1
wait(1)
if roundTime <= 0 then
break
end
end
for i, player in pairs(game.Players:GetPlayers()) do
if player.Character:FindFirstChildOfClass("Tool") then
player.Character:FindFirstChildOfClass("Tool"):Destroy()
player:LoadCharacter()
else
player:LoadCharacter()
end
end
else
print("not enough!")
end
end
end
thx for any help you can give! i will apreciate all help!