Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 08:35 AM |
Player = game.Players.LocalPlayer vSpawn = game.Workspace.Valtek.SpawnLocation vHW = game.Workspace.Valtek.Empire.homeWorld Button = script.Parent HasPressedTeleport = false
function TeleportPlayer() if HasPressedTeleport == false then Player.Character:MoveTo(vSpawn.Position) Button.BackgroundColor3 = Color3.new (19,255,113) HasPressedTeleport = true else if HasPressedTeleport == true then Player.Character:MoveTo(vHW.Position) Button.BackgroundColor3 = Color3.new (255,1,1) HasPressedTeleport = false end end
Button.MouseButton1Down:Connect(TeleportPlayer)
anyone see whats wrong with my script? |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Apr 2015 08:38 AM |
Player.Character:MoveTo(vSpawn.Position) to Player.Character.Torso.CFrame = vSpawn.CFrame |
|
|
| Report Abuse |
|
|
| |
|
|
| 21 Apr 2015 08:42 AM |
| Wasn't he looking to teleport the player? |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 08:44 AM |
You shouldn't set the CFrame of Torso though. That wasn't his error. He didn't provide one.
However @OP it's Color3.new(34/255, 0, 1) as an example, You divide any number higher then 1 |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 08:44 AM |
| Still nothing happens when its clicked |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 08:46 AM |
| shouldn't it be lower case connect() |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 08:48 AM |
| changed it and that didn't seem to be the problem |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 08:50 AM |
"elseif"
Tell me though exactly what's wrong? Output? |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 08:56 AM |
Player = game.Players.LocalPlayer vSpawn = game.Workspace.Valtek.SpawnLocation vHW = game.Workspace.Valtek.Empire.homeWorld Button = script.Parent HasPressedTeleport = true
function TeleportPlayer() if HasPressedTeleport == false then Player.Character.Torso.CFrame = vSpawn.CFrame Button.BackgroundColor3 = Color3.new(19,255,113) Button.text = "Teleport to Ship" HasPressedTeleport = true elseif HasPressedTeleport == true then Player.Character.Torso.CFrame = vHW.CFrame Button.BackgroundColor3 = Color3.new(255,1,1) Button.text = "Teleport to HomeWorld" HasPressedTeleport = false end end
Button.MouseButton1Down:connect(TeleportPlayer)
ok so now it teleports the player once to the homeworld but then wont take you back or change the text |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:00 AM |
"Button.BackgroundColor3 = Color3.new(255,1,1)"
Should be
"Button.BackgroundColor3 = Color3.new(1,1,1)"
There isn't a point to do 255 if all the other's are 1 which is equal to 255 (Assuming your making white)
"Button.BackgroundColor3 = Color3.new(19,255,113)"
Should be
"Button.BackgroundColor3 = Color3.new(19/255,1,113/255)"
Color3 only takes numbers > 0 < 1, dividing will make that right |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 09:08 AM |
| that fixed the colors but it still wont take him back to the ship |
|
|
| Report Abuse |
|
|
| |
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 09:13 AM |
10:03:15.283 - text is not a valid member of TextButton 10:03:15.284 - Script 'Players.Player.PlayerGui.SideBar.Background.TextButton.Scri', Line 16 10:03:15.284 - Stack End |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:16 AM |
How did I not catch that?
Button.Text
Case Sensitive stuff, Keep that in mind |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 09:22 AM |
sorry Im used to coding in different languages.
Player = game.Players.LocalPlayer vSpawn = game.Workspace.Valtek.SpawnLocation vHW = game.Workspace.Valtek.Empire.homeWorld Button = script.Parent HasPressedTeleport = true
function TeleportPlayer() if HasPressedTeleport == false then Player.Character.Torso.CFrame = vSpawn.CFrame Button.BackgroundColor3 = Color3.new(19/255,1,113/255) Button.Text = "Teleport to HomeWorld" HasPressedTeleport = true elseif HasPressedTeleport == true then Player.Character.Torso.CFrame = vHW.CFrame Button.BackgroundColor3 = Color3.new(1,0,0) Button.Text = "Teleport to Ship" HasPressedTeleport = false end end
Button.MouseButton1Down:connect(TeleportPlayer)
that fixed pretty much all of it, how would I make the player teleport 10 y higher than the specified position? would it be like vSpawn.CFrame.Y + 10 |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:24 AM |
| Player.Character.Torso.CFrame = vHW.CFrame + CFrame.new(0,10,0) |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:25 AM |
wait i forget Player.Character.Torso.CFrame = vHW.CFrame * CFrame.new(0,10,0) |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:27 AM |
^
Do that, But like I said :MoveTo() is better |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
| |
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 09:36 AM |
my goal is to make it so that players on each team will go to different places when they teleport for instance this is a start.
Player = game.Players.LocalPlayer
vSpawn = game.Workspace.Valtek.SpawnLocation vHW = game.Workspace.Valtek.Empire.homeWorld
bSpawn = game.Workspace.Baris.SpawnLocation bHW = game.Workspace.Valtek.Empire.homeWorld
Button = script.Parent HasPressedTeleport = true
function TeleportPlayer() if HasPressedTeleport == false then Button.BackgroundColor3 = Color3.new(19/255,1,113/255) Button.Text = "Teleport to HomeWorld" HasPressedTeleport = true if Player.TeamColor == (1,0,0) then Player.Character.Torso.CFrame = vSpawn.CFrame * CFrame.new(0,6,0) elseif Player.TeamColor == (0,1,0) then Player.Character.Torso.CFrame = bSpawn.CFrame * CFrame.new(0,6,0) end elseif HasPressedTeleport == true then Button.BackgroundColor3 = Color3.new(1,0,0) Button.Text = "Teleport to Ship" HasPressedTeleport = false if Player.TeamColor == (1,0,0) then Player.Character.Torso.CFrame = vHW.CFrame * CFrame.new(0,6,0) elseif Player.TeamColor == (0,1,0) then Player.Character.Torso.CFrame = bHW.CFrame * CFrame.new(0,6,0) end end end
Button.MouseButton1Down:connect(TeleportPlayer)
|
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:37 AM |
Player.TeamColor == (1,0,0)
TeamColor is a BrickColor, BrickColor.new("Bright blue")
Also, math.random() |
|
|
| Report Abuse |
|
|
Raildex
|
  |
| Joined: 06 Dec 2009 |
| Total Posts: 934 |
|
|
| 21 Apr 2015 09:39 AM |
| what would math.random be doing in there? |
|
|
| Report Abuse |
|
|
|
| 21 Apr 2015 09:40 AM |
| Oh, Nevermind. Ignore math.random |
|
|
| Report Abuse |
|
|