|
| 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 |
|
|
| |
|
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
|
  |
| 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 |
|
|
| |
|
|
| 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
|
  |
| Joined: 11 Jul 2008 |
| Total Posts: 1040 |
|
| |
|
|
| 31 Dec 2012 07:50 AM |
| RedSpawns is the position at which Team Red gets teleported, right? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 31 Dec 2012 07:53 AM |
Yeah, I like being boring :P
Thanks. |
|
|
| Report Abuse |
|
|
| |
|
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
|
  |
| 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
|
  |
| 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 |
|
|