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
 

Re: Gui Teleporting

Previous Thread :: Next Thread 
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Nov 2011 08:42 AM
I have this script, and was trying to make a gui button, that randomly chooses one of the five bricks that you would be teleported to.

--Script

char = script.Parent.Parent.Parent.Parent.Parent.Character
tele = game.Workspace.Teleporters

function Click()
number = math.random(1,5)
if number == 1 then
char.Torso.CFrame = tele.One.CFrame
end
if number == 2 then
char.Torso.CFrame = tele.Two.CFrame
end
if number == 3 then
char.Torso.CFrame = tele.Three.CFrame
end
if number == 4 then
char.Torso.CFrame = tele.Four.CFrame
end
if number == 5 then
char.Torso.CFrame = tele.Five.CFrame
end
end

script.Parent.MouseButton1Down:connect(Click)

--I don't know what's wrong. Probably everything =/


Report Abuse
Thunderx10 is not online. Thunderx10
Joined: 17 Jun 2009
Total Posts: 2316
08 Nov 2011 08:53 AM
T = { "One", "Two", "Three", "Four", "Five" }

char = script.Parent.Parent.Parent.Parent.Parent.Character
tele = workspace.Teleporters

function Click()
telepick = T[math.random(1, #T)]
char.Torso.CFrame = tele[telepick].CFrame
end
script.Parent.MouseButton1Down:connect(Click)

--**WIN**
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Nov 2011 09:01 AM
Hmm, looks good, but it doesn't work for me. Thanks for your time though.
Report Abuse
Thunderx10 is not online. Thunderx10
Joined: 17 Jun 2009
Total Posts: 2316
08 Nov 2011 09:04 AM
You messed up on your parenting probably, check over it.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Nov 2011 09:09 AM
Lemme check then.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
08 Nov 2011 09:13 AM
Haha, added an extra .Parent to char. Thanks again Thunder.
Report Abuse
Thunderx10 is not online. Thunderx10
Joined: 17 Jun 2009
Total Posts: 2316
08 Nov 2011 09:30 AM
You're welcome :)
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