Every time I enter the code math.randomout of 1 and 2, it ALWAYS seems to favor 1! Here's the full code.
h=Instance.new("Hint")
h.Parent=game.Workspace
while wait(1) do
script.StarterMusic:Play()
script.Hide:Stop()
--variables
h.Text=""
--round starts
i=10
while wait(1) and i>0 do
h.Text=i.." seconds until the round starts!"
i=i-1
end
h.Text="Choosing a random map..."
local maps = game.ServerStorage["Maps"]:GetChildren()
wait(3)
players=game.Players:getChildren()
map = maps[math.random(1, #maps)]
h.Text="The chosen map is "..map.Name.." by "..map.Creator.Value.."!"
--makes the map
mapclone=map:Clone()
mapclone.Parent=game.Workspace
wait(3)
h.Text="Teleporting players..."
p=3
for i=1,#players do
if players[i].playing.Value==1 then
local Tel1 = mapclone:findFirstChild("Spawn")--Our parenting part. The part we first touch.
players[i].Character.Humanoid.WalkSpeed=0
players[i].Character.Torso.CFrame=CFrame.new(Tel1.Position+Vector3.new(0,p,0))
p=p+5
end
end
wait(3)
h.Text="All players have 1 minute to finish. Go!"
wait(2)
for i=1,#players do
players[i].Character.Humanoid.WalkSpeed=20
end
script.StarterMusic:Stop()
script.Hide:Play()
i=60
while wait(1) and i>0 do
h.Text="You have "..i.." seconds left!"
i=i-1
end
mapclone:Destroy()
for i=1,#players do
if players[i].won.Value==1 then
players[i].leaderstats.Wins.Value=players[i].leaderstats.Wins.Value+1
players[i].leaderstats.Credits.Value=players[i].leaderstats.Credits.Value+10
players[i].won.Value=0
end
end
end
for i=1,#players do
local Tel1 = game.Workspace:findFirstChild("LobbySpawn"
players[i].Character.Torso.CFrame=CFrame.new(Tel1.Position+Vector3.new(0,3,0))
end
I need it to choose numbers that have more...er...RANDOMness than just math.random. Help is appreciated!
-ds
