Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I fix this lobby script??

Okay, so I'm building a game called Bullseye and I've made a script for it, but the thing is, the script itself works but where those location numbers are, they are my spawns & every time I enter the game, after 20 seconds, I'm always teleported to the "terrorist" spawn which is the first location on the script. How do I make the player spawns in a random team. The teams are "Terrorist" "Feds" & "Civilians" I want the Terrorists to have the least players (around 1-3, 3 being the max) Feds having 2-5 (2 being the minimum and 5 the maximum) and Civilians get the rest of the players. Any help is greatly appreciated. Sorry if this doesn't make sense.


while true do
local start = 20

local hint = Instance.new("Hint") 
hint.Parent = game.Workspace 
for i = 1,start do
hint.Text = start - i 
wait(1) 
end
hint.Text = "Game Starting" -- Change this to what you want it to say when its starting the game
wait(2)
hint:remove()

players= game.Players:GetChildren() -- \/ -122.6 is the first location
random = CFrame.new(-122.6, 4.59, -199.6 or -104.6, 4.59, -85 or -132.6, 4.59, 13.6) -- Location you want them to go
for i, player in pairs(game.Players:GetChildren()) do
player.Character.Torso.CFrame = random + Vector3.new(0, i * 5, 0), Vector3.new(0, i * 5, 0), Vector3.new(0, i * 5, 0)
end

local start = 500
for i = 1,start do
hint.Text = start - i 
wait(1) 
end
hint.Text = "Game Over" -- Lose message
p = game.Players:GetChildren()
for i = 1,#p do
p[i].Character.Head:remove()
end
wait(2)
hint:remove()

end

1 answer

Change the locations part to something like this

local locations={Cframe.new(0,0,0)} --Add locations here
player.Character:MoveTo(locations[math.random(1,#locations)])

1 comment

0

You have no idea how CFrame works, soo no. Just gtfo.

This discussion is preserved as it was. New answers, comments, and votes are closed.