The Goal For This Script Is To Run A Simple Game Loops, And Then Pick A Random Player. The issue is, the code seems to completely skip the part of removing all the players "clothing". But will continue with the loop for 'Game'.
--//Services//--
local players = game:GetService('Players')
--//Variables//--
local timeInt = 60
local intTime = 60
local pretime = 10
--//Round Objects//--
local status = game.ReplicatedStorage.Status
local spawnPoints = game.Workspace:FindFirstChild('Spawnpoints')
local lobbySpawns = game.Workspace:FindFirstChild('Lobbyspawns')
--//Main//--
while wait() do
--//Return To Lobby//--
for i,Player in pairs (players:GetPlayers()) do
if Player.Character then
Player.Character:SetPrimaryPartCFrame(lobbySpawns:FindFirstChild('Point' ..i).CFrame + Vector3.new(0,3,0))
end
end
--//Intermission Time//--
for i=intTime,1,-1 do
wait(1)
status.Value = 'intermission'
end
--//Bring Players To Map//--
for i,Player in pairs (players:GetPlayers()) do
Player.Character:SetPrimaryPartCFrame(spawnPoints:FindFirstChild('Point' ..i).CFrame + Vector3.new(0,3,0))
end
--//Signal Prematch//--
for i=pretime,1,-1 do
status.Value = 'prematch'
wait(1)
end
local currentPlayers = players:GetPlayers()
local firstInfected = currentPlayers[math.random(#currentPlayers)]
for _, child in pairs(firstInfected:GetChildren()) do
if child:IsA('Hat') then
child:Destroy()
end
if child:IsA('ShirtGraphic')then
child:Destroy()
end
if child:IsA('Pants')then
child:Destroy()
end
if child:IsA('Shirt')then
child:Destroy()
end
if child.Name == "Torso" then
for _, TorsoChild in pairs(child:GetChildren()) do
if TorsoChild:IsA('Decal')then
TorsoChild:Destroy()
end
end
end
end
--//Signal Match//--
for i=timeInt,1,-1 do
wait(1)
status.Value = 'game'
end
end
Thanks!
