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

Teleport to one of two spawnpoints script not working. Any help?

Asked by 5 years ago

So I have a Weapon Royale game, and I'm making it, so after 60 seconds, the players get teleported to the map, but heres where I am confused. I am able to easily make one spawnpoint, but I want each player to have a different spawnpoint. I tried to put "or" in the script, to make it choose one or the other, but one of the equal signs comes up red, and it says "Expected Indentifier, got '='" Can someone please Help me?

Heres the script with only one spawnpoint:

while true do
    wait(5)
game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame = CFrame.new(-901.5, 5, -306.1) 
wait(5)
game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame = CFrame.new(-31.86, 18.069, -18.085) 
wait()
end

Here's what the script looks like when i try to do more than one:

while true do
    wait(5)
game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame = CFrame.new(-901.5, 5, -306.1)  or game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame =
CFrame.new(-701, 5, 902)
wait(5)
game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Head.CFrame = CFrame.new(-31.86, 18.069, -18.085) 
wait()
end

Am I just using the "or" keyword wrong? Or do i have to do math.random. And how would I do math.random with spawnpoints?

0
You’re using the or keyword wrong. User#19524 175 — 5y
0
How? SBlankthorn 329 — 5y
0
You use it in conditional statements, line 3 of your last code snippet isn’t a conditional. Line 1 is, though. User#19524 175 — 5y
View all comments (7 more)
0
so would you have any idea what to do to fix it? SBlankthorn 329 — 5y
0
Remove the or, and remove the part that assigns the CFrame to (-701, 5, 902) User#19524 175 — 5y
0
Ok? But then it will only teleport to one spawnpoint. I want multiple. SBlankthorn 329 — 5y
0
Then assign it later. User#19524 175 — 5y
0
What does that mean? im a novice scripter. Like copy that script but change the coordinates? SBlankthorn 329 — 5y
0
Just make a table with your CFrame positions, then use math.random() to get a random position from the table. User#19524 175 — 5y
0
Alright that makes sense... do you have a discord we can talk this out on? SBlankthorn 329 — 5y

Answer this question