Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why wont my Random Spawn Script work? I wont randomly spawn [closed]

Asked by
kedny23 -14
7 years ago
Edited 7 years ago

Why doesnt this work. I did everything correct

~~~~~~~~~~~~~~~~~

local replicatedstorage = game:GetService('ReplicatedStorage')
local status = replicatedstorage:WaitForChild('InfoValue')
local mapstorage = game.Workspace:WaitForChild('MapStorage')
while true do
 while game.Players.NumPlayers > 2 do
 status.Value = 'There needs to be 2 or more players to begin'
 repeat wait(2) until game.Players.NumPlayers >= 2
end
for i = 30,0,-1 do
    status.Value = 'Intermission '..i
    wait(1)
end
local mapsinserverstorage = game:GetService('ServerStorage'):GetChildren()
local chosenmap = mapsinserverstorage[math.random(1, #mapsinserverstorage)]
chosenmap:Clone().Parent = mapstorage
status.Value = 'Get ready to die'
wait(3)
local spawns = chosenmap:WaitForChild('Spawns')
for _, player in pairs(game.Players:GetPlayers()) do
    if player and #spawns > 0 then
        local torso = player.Character:WaitForChild('Torso')
        local allspawns = math.random(1, #spawns)
        local randomspawn = spawns[allspawns]
        if randomspawn and torso then
            torso.CFrame = CFrame.new(randomspawn.Position + Vector3.new(0,2,0))
            table.remove(spawns, allspawns)     
        end
    end
end

for i = 60,0,-1 do if i == 0 then status.Value = 'Time Up!' for _, player in pairs(game.Player:GetPlayers()) do if player:FindFirstChild('leaderstats') then player.leaderstats.XP.Value = player.leaderstats.XP.Value + 10 end end break else end end mapstorage:ClearAllChildren() end~~~~~~~~~~~~~~~~~


Closed as Non-Descriptive by Goulstem

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by
kedny23 -14
7 years ago

i fixed it

Ad