I'm fairly new to scripting, and I learn of sites like this, but I am having a bit of trouble scripting this.I just need a jump start to it.
So I have a map and a lobby. In the lobby, I have the spawns that ROBLOX give you when you press the spawn button. In the map, I have multiple parts Labelled "Spawn1", "Spawn2", "Spawn3" etc.
So I want to script a text button, when pressed it will teleport you one of the random parts spread out across the map.
So I'm guessing it will be a local script inside the text label then it will be
local button = script.Parent
local mapspawns =
after "mapspawns = ", I'm not sure how I would define the multiple parts, so how would I do that bit?
Next, I want to teleport the players, I'm not too sure on this bit either. I would guess you move the Torso, because that's the main part. (correct me if it's wrong) So can someone teach me how to teleport the player, and not get them killed when doing so?
So I want the script to pick out a random spawn part, so I would put my bets on saying that a table would be required,(I'm awful at tables), and the math.Random() function. I looked it up on the developer blog Roblox has and it came up with generating random numbers.
So I'm guessing this is one way that it can be done:
So i define Spawn1 as "1", Spawn2 as "2" etc,
then I make math.Random() pick a number between 1 and 10 (let's say I have 10 spawns)
Then here I want to make the picked number to have a link to the Spawns.
So if I got 3 from the generation, I want the script to know I'm on about Spawn3. Do I have to do something here to let it know, like math.Random().Value or something (does that even exist?)
Then I want the teleportation bit to go here, so teleport the player's Torso to the value of math.Random()'s assigned Spawn. (Spawn1 = 1, etc,)
later on in the script, I can make the button go invisible after I press it and all myself. Simply by doing
button.Visible = false -- I defined it above
I know this is a huge question, but hopefully it will teach me the basics of a few things, which in turn can help me to script in the future by my self.
Thanks for reading! Please can you help me out?
EDIT: I just had an epiphany. So can I define the variable SpawnNumber using math.random()
so for example
local SpawnNumber = math.Random(1,10)
then can I do this?
if SpawnNumber.Value == 3
then
Teleport function here
Can someone tell me if this is right? Or Help me out if I have gone wrong and can someone teach me how I can do the things stated above?
Not sure what I should do after here though. ;/

2 comments
I will be answering the entirety of your question in a bit.
Ok thanks for your time and effort.