Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 05:44 AM |
Z=game.Players.LocalPlayer A=game.Workspace.BuildingAreas.Area1.Player.Value B=game.Workspace.BuildingAreas.Area2.Player.Value C=game.Workspace.BuildingAreas.Area3.Player.Value D=game.Workspace.BuildingAreas.Area4.Player.Value E=game.Workspace.BuildingAreas.Area5.Player.Value F=game.Workspace.BuildingAreas.Area6.Player.Value G=game.Workspace.BuildingAreas.Area7.Player.Value H=game.Workspace.BuildingAreas.Area8.Player.Value I=game.Workspace.BuildingAreas.Area9.Player.Value
function onClick() if A==Z then Z.Character.Torso.Position=game.ServerStorage.Area1.Value else if B==Z then Z.Character.Torso.Position=game.ServerStorage.Area2.Value else if C==Z then Z.Character.Torso.Position=game.ServerStorage.Area3.Value else if D==Z then Z.Character.Torso.Position=game.ServerStorage.Area4.Value else if E==Z then Z.Character.Torso.Position=game.ServerStorage.Area5.Value else if F==Z then Z.Character.Torso.Position=game.ServerStorage.Area6.Value else if G==Z then Z.Character.Torso.Position=game.ServerStorage.Area7.Value else if H==Z then Z.Character.Torso.Position=game.ServerStorage.Area8.Value if I==Z then Z.Character.Torso.Position=game.ServerStorage.Area9.Value end end end end end end end end end end script.Parent.MouseButton1Down:connect(onClick)
---------------------------------------------------------- --in ServerStorage, I have 9 strings containing the position of the spawns (example: -40, 47.08, -398)
--in game.Workspace.BuildingAreas.Area (1-9).Player.Value, it has the name of the owner with the baseplate/spawn.
--it's supposed to teleport you to your spawn/baseplate on click of the button. |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 05:59 AM |
Changed it to this but still doesn't work:
------------------------------------------------------------------- ------------------------------------------------------------------- Z=game.Players.LocalPlayer A=game.Workspace.BuildingAreas.Area1.Player.Value B=game.Workspace.BuildingAreas.Area2.Player.Value C=game.Workspace.BuildingAreas.Area3.Player.Value D=game.Workspace.BuildingAreas.Area4.Player.Value E=game.Workspace.BuildingAreas.Area5.Player.Value F=game.Workspace.BuildingAreas.Area6.Player.Value G=game.Workspace.BuildingAreas.Area7.Player.Value H=game.Workspace.BuildingAreas.Area8.Player.Value I=game.Workspace.BuildingAreas.Area9.Player.Value
function onClick() if A==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -398) else if B==Z then Z.Torso.CFrame=CFrame.new(24, 47.08, -453) else if C==Z then Z.Torso.CFrame=CFrame.new(15, 47.08, -333) else if D==Z then Z.Torso.CFrame=CFrame.new(80, 47.08, -388) else if E==Z then Z.Torso.CFrame=CFrame.new(-152, 47.08, -398) else if F==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -333) else if G==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -510) else if H==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -557) if I==Z then Z.Torso.CFrame=CFrame.new(25, 47.08, -565) end end end end end end end end end end script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
nacker
|
  |
| Joined: 06 Oct 2009 |
| Total Posts: 6034 |
|
|
| 17 May 2014 06:06 AM |
| try using elseif instead of else if |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 06:10 AM |
I was using something similar to that. It was like:
___________ then ____________________ elseif if _________ then
i was using elseif and if and it was erroring so i removed the elseifs and made them else with if on another line but i'll try removing the ifs and elses and making them elseifs |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 06:14 AM |
So the new script is this: (btw it doesn't work)
------------------------------------------------ ------------------------------------------------ Z=game.Players.LocalPlayer A=game.Workspace.BuildingAreas.Area1.Player.Value B=game.Workspace.BuildingAreas.Area2.Player.Value C=game.Workspace.BuildingAreas.Area3.Player.Value D=game.Workspace.BuildingAreas.Area4.Player.Value E=game.Workspace.BuildingAreas.Area5.Player.Value F=game.Workspace.BuildingAreas.Area6.Player.Value G=game.Workspace.BuildingAreas.Area7.Player.Value H=game.Workspace.BuildingAreas.Area8.Player.Value I=game.Workspace.BuildingAreas.Area9.Player.Value
function onClick() if A==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -398) elseif B==Z then Z.Torso.CFrame=CFrame.new(24, 47.08, -453) elseif C==Z then Z.Torso.CFrame=CFrame.new(15, 47.08, -333) elseif D==Z then Z.Torso.CFrame=CFrame.new(80, 47.08, -388) elseif E==Z then Z.Torso.CFrame=CFrame.new(-152, 47.08, -398) elseif F==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -333) elseif G==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -510) elseif H==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -557) elseif I==Z then Z.Torso.CFrame=CFrame.new(25, 47.08, -565) end end script.Parent.MouseButton1Down:connect(onClick) |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
| |
|
|
| 17 May 2014 06:31 AM |
what is the script's parent
|
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 06:32 AM |
scripts parent is a button named teleport
game.Workspace.StarterGui.ScreenGui.Frame.teleport
^^ |
|
|
| Report Abuse |
|
|
| |
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 06:33 AM |
I MEANT game.StarterGui
not workspace sorry |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 06:38 AM |
you are my only hope mr verifiedname save me from these errors |
|
|
| Report Abuse |
|
|
Ace23333
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 1341 |
|
|
| 17 May 2014 06:45 AM |
| What are Values of A, B, C, D and others? |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 07:02 AM |
@Ace
they are strings which hold the name of the player working on each area |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 07:15 AM |
| as soon as i can get this fixed i can continue with adding more features |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 07:30 AM |
repeat wait() Z=game.Players.LocalPlayer A=game.Workspace.BuildingAreas.Area1.Player.Value B=game.Workspace.BuildingAreas.Area2.Player.Value C=game.Workspace.BuildingAreas.Area3.Player.Value D=game.Workspace.BuildingAreas.Area4.Player.Value E=game.Workspace.BuildingAreas.Area5.Player.Value F=game.Workspace.BuildingAreas.Area6.Player.Value G=game.Workspace.BuildingAreas.Area7.Player.Value H=game.Workspace.BuildingAreas.Area8.Player.Value I=game.Workspace.BuildingAreas.Area9.Player.Value until Z and A and B and C and D and E and F and G and H and I |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 07:35 AM |
repeat wait() Z=game.Players.LocalPlayer A=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area1"):FindFirstChild("Player").Value B=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area2"):FindFirstChild("Player").Value C=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area3"):FindFirstChild("Player").Value D=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area4"):FindFirstChild("Player").Value E=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area5"):FindFirstChild("Player").Value F=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area6"):FindFirstChild("Player").Value G=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area7"):FindFirstChild("Player").Value H=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area8"):FindFirstChild("Player").Value I=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area9"):FindFirstChild("Player").Value until Z and A and B and C and D and E and F and G and H and I |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 08:15 AM |
not sure if i was supposed to add things to that script or if that was a full script but i don't think that does what i wanted it to do
basically i need the script to do this:
check each "Area" model in BuildingAreas (i.e game.Workspace.BuildingAreas.Area1) and then look at the stringvalue called Player in each area and if the value of that is the same as the localplayer it teleports the localplayer to the specific position which i can add myself |
|
|
| Report Abuse |
|
|
|
| 17 May 2014 08:27 AM |
repeat wait() Z=game.Players.LocalPlayer A=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area1"):FindFirstChild("Player").Value B=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area2"):FindFirstChild("Player").Value C=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area3"):FindFirstChild("Player").Value D=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area4"):FindFirstChild("Player").Value E=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area5"):FindFirstChild("Player").Value F=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area6"):FindFirstChild("Player").Value G=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area7"):FindFirstChild("Player").Value H=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area8"):FindFirstChild("Player").Value I=Workspace:FindFirstChild("BuildingAreas"):FindFirstChild("Area9"):FindFirstChild("Player").Value until Z and A and B and C and D and E and F and G and H and I
script.Parent.MouseButton1Down:connect(function() if A==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -398) elseif B==Z then Z.Torso.CFrame=CFrame.new(24, 47.08, -453) elseif C==Z then Z.Torso.CFrame=CFrame.new(15, 47.08, -333) elseif D==Z then Z.Torso.CFrame=CFrame.new(80, 47.08, -388) elseif E==Z then Z.Torso.CFrame=CFrame.new(-152, 47.08, -398) elseif F==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -333) elseif G==Z then Z.Torso.CFrame=CFrame.new(-40, 47.08, -510) elseif H==Z then Z.Torso.CFrame=CFrame.new(-97, 47.08, -557) elseif I==Z then Z.Torso.CFrame=CFrame.new(25, 47.08, -565) end end)
Full script |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 08:38 AM |
thanks so much for writing that for me but it won't work and has no output
:( |
|
|
| Report Abuse |
|
|
Verthandi
|
  |
| Joined: 21 Apr 2014 |
| Total Posts: 65 |
|
|
| 17 May 2014 08:40 AM |
local player = game.Players.LocalPlayer;
script.Parent.MouseButton1Down:connect(function() for i,v in pairs(workspace.BuildingAreas:GetChildren()) do coroutine.resume(coroutine.create(function() for o,j in pairs(v:GetChildren()) do if (j.Name:sub(1,4)=="Area") and (j:findFirstChild("Player")) then if (j.Player.Value==player) then player.Character.Torso.CFrame=CFrame.new(0,0,0) + game.ServerStorage[j.Name].Value; break end end end end)) end end); |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 08:43 AM |
@verth
didn't work no output but thanks |
|
|
| Report Abuse |
|
|
Verthandi
|
  |
| Joined: 21 Apr 2014 |
| Total Posts: 65 |
|
|
| 17 May 2014 08:44 AM |
It works, I just tested it.
I might have gotten the location of your stuff wrong though. |
|
|
| Report Abuse |
|
|
Verthandi
|
  |
| Joined: 21 Apr 2014 |
| Total Posts: 65 |
|
|
| 17 May 2014 08:46 AM |
Try this one.
local player = game.Players.LocalPlayer;
script.Parent.MouseButton1Down:connect(function() for i,v in pairs(workspace.BuildingAreas:GetChildren()) do if (v:findFirstChild("Player")) then if (v.Player.Value==player) then player.Character.Torso.CFrame=CFrame.new(0,0,0) + game.ServerStorage[v.Name].Value; break end end end end); |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 08:47 AM |
uh well
the things are:
game.Workspace.BuildingAreas.Area 1-9 -- this is where areas 1-9 are held game.Workspace.BuildingAreas.Area#.Player.Value -- this is the value of the string that holds the player which has the basplate basically
it checks which area the localplayer belongs to (using the Player.Value in the area) and then teleports the localplayer to that baseplate |
|
|
| Report Abuse |
|
|
Phyclops
|
  |
| Joined: 27 Sep 2012 |
| Total Posts: 5895 |
|
|
| 17 May 2014 08:48 AM |
second one didn't work with no output |
|
|
| Report Abuse |
|
|