zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:11 PM |
I am trying to make a teleport random button (gui) that first teleports a person to the spot (zabba at -473.5, 63, -1195), changes a stringvalue called "Last" in the same textbutton to the name of the player teleported, then takes a new player (if there is more than one person in the server), checks to make sure this person isn't the last person taken, then moves the new person to the spot.
The issue here is that if the player IS the same as last teleported, the script ends. I don't just want to copy and paste that part of the script over and over again. Is there a certain way to repeat that with only a few more lines?
zabba = Vector3.new(-473.5, 63, -1195) function Click() local c = game.Players:GetChildren() local r = math.random(1,#c) if c[r].className == "Player" then script.Parent.Last.Value = c[r].Name c[r].Character:MoveTo(zabba) print("moved the first character") end
local z = game.Players:GetChildren() --I didn't have to create another of these, did I? local b = math.random(1,#z) if #z > 1 then if z[b].className == "Player" then if z[b].Name ~= script.Parent.Last.Value then script.Parent.Last.Value = "" z[b].Character:MoveTo(zabba) print("moved the second character") else print("The teleportee was the first teleportee!") end end else print("Only one player") end end script.Parent.MouseButton1Click:connect(Click) |
|
|
| Report Abuse |
|
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:23 PM |
| No- I want the two random players to be teleported to that spot. I wrote that in there. I want two different players to be moved there to duel each other. |
|
|
| Report Abuse |
|
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:29 PM |
| No, this is the whole script. I have seperate scripts for seperate purposes, though...? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:35 PM |
| Ok thanks. I'll try that... |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:40 PM |
| It doesn't work. I took my sis to the place but it didn't do anything. I can't have 2 people in studio. |
|
|
| Report Abuse |
|
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:42 PM |
| *back from pee-ing* ...so I don't get any feedback from the output. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 09:54 PM |
| Ok I will reset the server now. I am kind of skeptical that finding the second player is not part of the Click function... |
|
|
| Report Abuse |
|
|
| |
|
zabba7461
|
  |
| Joined: 21 Aug 2011 |
| Total Posts: 179 |
|
|
| 10 Jul 2012 10:21 PM |
| Ok thanks so much. It finally worked. |
|
|
| Report Abuse |
|
|