I want to make a game where one random player spawns at one point while the rest of the players spawn at another block. I truly appreciate all your help but I am really trying to learn how to code in Roblox. I barely started two weeks ago and thanks to you guys, I can now clone blocks, create debounces, and create block GUI's on my own. My first game is almost done but I can't do it without you guys. Here is my current script:
local TextBox = script.Parent local Spawn = game.Workspace.Spawn if TextBox then TextBox.Text = 'intermission' wait(4) TextBox.Text = '10' wait(1) TextBox.Text = '9' wait(1) TextBox.Text = '8' wait(1) TextBox.Text = '7' wait(1) TextBox.Text = '6' wait(1) TextBox.Text = '5' wait(1) TextBox.Text = '4' wait(1) TextBox.Text = '3' wait(1) TextBox.Text = '2' wait(1) TextBox.Text = '1' wait(1) TextBox.Text = "loading" wait(3) game.Players.PlayerAdded.Position = Spawn.Position end
I know that there are math scripts to do the -1 second instead of typing all the text scripts, but that will be for another time. When the loading text starts and the wait is over, I want one player to be randomly selected to spawn at one point, the rest to another. I would love for you to be so kind and teach me how to script this. Thank you so much!
Sincerely,
Or2no
local TextBox = script.Parent local Spawn = game.Workspace.Spawn local OtherPart = workspace.INSERTPARTHERE if TextBox then TextBox.Text = 'intermission' wait(4) TextBox.Text = '10' wait(1) TextBox.Text = '9' wait(1) TextBox.Text = '8' wait(1) TextBox.Text = '7' wait(1) TextBox.Text = '6' wait(1) TextBox.Text = '5' wait(1) TextBox.Text = '4' wait(1) TextBox.Text = '3' wait(1) TextBox.Text = '2' wait(1) TextBox.Text = '1' wait(1) TextBox.Text = "loading" wait(3) for i,v in pairs(game:GetService("Players"):GetPlayers()) do v.Character.HumanoidRootPart.CFrame = Spawn.CFrame -- gets all players and teleports them to spawn. end for i,v in pairs(game:GetService("Players"):GetPlayers()) do v.Character.HumanoidRootPart.CFrame = OtherPart.CFrame break -- this break will stop the loop from being run more than once; only teleporting a single player to the "OtherPart". end
You were trying to teleport the player, not the player's character. Please also don't use "PlayerAdded" because it will not get all players in the current game. I added a variable, "OtherPart" that you can edit around yourself. If this doesn't work or you have questions, feel free to add a comment!