generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

[ Content Deleted ]

Previous Thread :: Next Thread 
zabba7461 is not online. 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
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:14 PM
[ Content Deleted ]
Report Abuse
zabba7461 is not online. 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
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:26 PM
[ Content Deleted ]
Report Abuse
zabba7461 is not online. 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
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:30 PM
[ Content Deleted ]
Report Abuse
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:33 PM
[ Content Deleted ]
Report Abuse
zabba7461 is not online. zabba7461
Joined: 21 Aug 2011
Total Posts: 179
10 Jul 2012 09:35 PM
Ok thanks. I'll try that...
Report Abuse
zabba7461 is not online. 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 is not online. 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
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:44 PM
[ Content Deleted ]
Report Abuse
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:47 PM
[ Content Deleted ]
Report Abuse
zabba7461 is not online. 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
darkjunior is not online. darkjunior
Joined: 05 Sep 2008
Total Posts: 2224
10 Jul 2012 09:55 PM
[ Content Deleted ]
Report Abuse
zabba7461 is not online. zabba7461
Joined: 21 Aug 2011
Total Posts: 179
10 Jul 2012 10:21 PM
Ok thanks so much. It finally worked.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image