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 » Scripters
Home Search
 

Re: Teleport script error

Previous Thread :: Next Thread 
Raildex is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 08:37 AM
What's the error?
Report Abuse
LavanderLights is not online. LavanderLights
Joined: 21 Oct 2013
Total Posts: 3526
21 Apr 2015 08:38 AM
Player.Character:MoveTo(vSpawn.Position) to
Player.Character.Torso.CFrame = vSpawn.CFrame
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 08:40 AM
^ No
Report Abuse
LavanderLights is not online. LavanderLights
Joined: 21 Oct 2013
Total Posts: 3526
21 Apr 2015 08:42 AM
Wasn't he looking to teleport the player?
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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 is not online. Raildex
Joined: 06 Dec 2009
Total Posts: 934
21 Apr 2015 08:44 AM
Still nothing happens when its clicked
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 08:46 AM
shouldn't it be lower case connect()
Report Abuse
Raildex is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 08:50 AM
"elseif"

Tell me though exactly what's wrong? Output?
Report Abuse
Raildex is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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 is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 09:10 AM
Output say anything?
Report Abuse
Raildex is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 09:16 AM
How did I not catch that?

Button.Text

Case Sensitive stuff, Keep that in mind
Report Abuse
Raildex is not online. 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
LavanderLights is not online. LavanderLights
Joined: 21 Oct 2013
Total Posts: 3526
21 Apr 2015 09:24 AM
Player.Character.Torso.CFrame = vHW.CFrame + CFrame.new(0,10,0)
Report Abuse
LavanderLights is not online. LavanderLights
Joined: 21 Oct 2013
Total Posts: 3526
21 Apr 2015 09:25 AM
wait i forget
Player.Character.Torso.CFrame = vHW.CFrame * CFrame.new(0,10,0)
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 09:27 AM
^

Do that, But like I said :MoveTo() is better
Report Abuse
Raildex is not online. Raildex
Joined: 06 Dec 2009
Total Posts: 934
21 Apr 2015 09:27 AM
thanks
Report Abuse
Raildex is not online. 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
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
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 is not online. Raildex
Joined: 06 Dec 2009
Total Posts: 934
21 Apr 2015 09:39 AM
what would math.random be doing in there?
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
21 Apr 2015 09:40 AM
Oh, Nevermind. Ignore math.random
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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