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: Teleport GUI Help

Previous Thread :: Next Thread 
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:31 AM
function onClicked()
if script.Parent.Parent.Parent.Parent.Character:FindFirstChild("Board") ~= nil then
script.Parent.Parent.Parent.Parent.Character.Board:remove()
end
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(3, -378.4, 32)
end
script.Parent.MouseButton1Down:connect(onClicked)
---------------

Can somebody make it so if the player that clicks the GUI is in team Red it teleports him to
-118, 0.8, 5 and if hes from team Blue it teleports him to -4, 0.8, 97

I think it has something to do with if and else if but Im not sure how to do it.
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:37 AM
Ignore the 3, -378.4, 32
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
31 Dec 2012 07:43 AM
I feel like over complicating things.. :D

------------------------------------------------------------------

BlueTeam = "Put exact blue color here"
RedTeam = "Put exact red color here"
BlueSpawns = {}
RedSpawns = {}

function onClicked()
if script.Parent.Parent.Parent.Parent.Character:FindFirstChild("Board") ~= nil then
script.Parent.Parent.Parent.Parent.Character.Board:remove()
end
if script.Parent.Parent.Parent.Parent.TeamColor == BrickColor.new(BlueTeam) then
for i = 1, #game.Workspace:GetChildren() do
if game.Workspace:GetChildren()[i]:IsA("SpawnLocation") then
if game.Workspace:GetChildren()[i].TeamColor == BrickColor.new(BlueTeam) then
table.insert(BlueSpawns, game.Workspace:GetChildren()[i])
end
end
end
BRandom = BlueSpawns[math.random(#BlueSpawns)]
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(BRandom.Position + Vector3.new(math.random(1,5), math.random(1,5), math.random(1,5)))
elseif script.Parent.Parent.Parent.Parent.TeamColor == BrickColor.new(RedTeam) then
for i = 1, #game.Workspace:GetChildren() do
if game.Workspace:GetChildren()[i]:IsA("SpawnLocation") then
if game.Workspace:GetChildren()[i].TeamColor == BrickColor.new(RedTeam) then
table.insert(RedSpawns, game.Workspace:GetChildren()[i])
end
end
end
RRandom = BlueSpawns[math.random(#RedSpawns)]
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(RRandom.Position + Vector3.new(math.random(1,5), math.random(1,5), math.random(1,5)))
end
end
script.Parent.MouseButton1Down:connect(onClicked)




---

Over complicating FTW. Didn't even do what you asked. I am so special. Nor do I even know if it would work. Just free scripting with no sleep for 18 hours.
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
31 Dec 2012 07:44 AM
What that above does (Or is supposed to):

Find all the spawns with that spawn color, and if they are in that color, pick a random spawn (of that team) and teleport to it.
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:44 AM
what the
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:47 AM
BlueTeam = "Put exact blue color here"
RedTeam = "Put exact red color here"

So I should put the exact colors?

Like Bright blue and Bright red?
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
31 Dec 2012 07:48 AM
Yesh
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:50 AM
RedSpawns is the position at which Team Red gets teleported, right?
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
31 Dec 2012 07:52 AM
If you want to be boring about it... Or incase my over complicated above one was wrong..

--

BlueColor = "Bright blue"
RedColor = "Bright red"

function onClicked()
if script.Parent.Parent.Parent.Parent.Character:FindFirstChild("Board") ~= nil then
script.Parent.Parent.Parent.Parent.Character.Board:remove()
end
if script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(BlueColor) then
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-4, 0.8, 97)
elseif script.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new(RedColor)
script.Parent.Parent.Parent.Parent.Character.Torso.CFrame = CFrame.new(-118, 0.8, 5)
end
end
script.Parent.MouseButton1Down:connect(onClicked)
Report Abuse
dradra44 is not online. dradra44
Joined: 11 Jul 2008
Total Posts: 1040
31 Dec 2012 07:53 AM
Dont mess with anything else except the Colors in my complicated one.

/Floodcheckisfun
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 07:53 AM
Yeah, I like being boring :P

Thanks.
Report Abuse
NextStudio is not online. NextStudio
Joined: 27 Dec 2012
Total Posts: 61
31 Dec 2012 08:12 AM
Umm they dont work
Report Abuse
llharry is not online. llharry
Joined: 31 Aug 2008
Total Posts: 46
31 Dec 2012 08:35 AM
You could just use :MoveTo()
I'll send you a working version of mine, which tps one person to another. You can edit it to your liking ^^
function teleport(TP)
name = script.Parent.Parent.TPIname1.Text -- First gui. Picks name which will teleport to...
name2 = script.Parent.Parent.TPname2.Text -- <- ...That name.
path = game.Workspace -- Quicker war of writing workspace. I'm lazy.
if path:FindFirstChild(name) and path:FindFirstChild(name2) then -- Checking if players exist. Probably should check for humanoids.
x2 = path:FindFirstChild(name).Torso.Position -- Once again, lazy.
y2 = path:FindFirstChild(name2).Torso.Position -- ^^^^^^^^^^

x2:moveTo(y2 + Vector3.new(0,4,0)) -- Using :moveTo() to make x2 = to y2. Also putting them 4 studs above so they dont spawn in each other.
else
name = "Failed to TP, Sorry!"
end
end
script.Parent.MouseButton1Click:connect(teleport) -- When you click the GUI. Script is inside the button.
Report Abuse
llharry is not online. llharry
Joined: 31 Aug 2008
Total Posts: 46
31 Dec 2012 08:36 AM
Sorry. That will be much easier to read if you put it in studio.
Report Abuse
llharry is not online. llharry
Joined: 31 Aug 2008
Total Posts: 46
31 Dec 2012 08:38 AM
Also (Sorry for triple post) You could use a for loop with a :getChildren() functions table to teleport to people one by one. Mine is currently only designed for tping one person to another, but should teach you the :moveTo() function
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