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: Need help on teleportservice

Previous Thread :: Next Thread 
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:19 PM
The following script works in ROBLOX Studio, and the error given ingame is Invalid player.

local id = 281427696
script.Parent.AreYouSureFrame.YesButton.MouseButton1Click:connect(function(player)
print("Prepare to be teleported.")
game:GetService("TeleportService"):Teleport(id, player)
print("Teleporting")
end)

Please help.
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:22 PM
b1
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:27 PM
b2
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:31 PM
ay helping is caring
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:38 PM
bump3
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:46 PM
Please, help me.
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:50 PM
bump4
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
25 Nov 2015 08:53 PM
It doesn't give the player as a parameter of MouseButton1Click.
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
25 Nov 2015 08:56 PM
So, how do I get player into a value that will allow the person, who click the textbutton, to teleport?
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 02:33 PM
b5
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 03:01 PM
b6
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Nov 2015 03:03 PM
local player = game.Players.LocalPlayer
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 03:04 PM
local id = 281427696
script.Parent.AreYouSureFrame.YesButton.MouseButton1Click:connect(function(player)
local player = game.Players.LocalPlayer
print("Prepare to be teleported.")
game:GetService("TeleportService"):Teleport(id, player)
print("Teleporting")
end)

Current script.
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Nov 2015 03:06 PM
remove the 'player' from here: function(player)
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
26 Nov 2015 03:08 PM
if you kept the player as the function's argument and printed it, it would have printed a number d;


-wiki before u forum
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 03:09 PM
Still not working.

I also put the two places in a Game Universe, so I really don't know what's happening.

The error called: Invalid player to teleport occurs ingame but not in Studio.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
26 Nov 2015 03:09 PM
Maybe you're testing it in studio?


-wiki before u forum
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 03:12 PM
When I print the value of player, it is nil.

Is this occurring because the script is not a local script?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
26 Nov 2015 03:12 PM
Is it a LocalScript?


-wiki before u forum
Report Abuse
cgjnm is not online. cgjnm
Joined: 22 Dec 2011
Total Posts: 2347
26 Nov 2015 03:12 PM
...


Anything with client must be local...
Report Abuse
Pen54321 is not online. Pen54321
Joined: 11 Jul 2012
Total Posts: 8894
26 Nov 2015 03:16 PM
Now I feel like an idiot for not using a local script.
Thank you guys. It now works.
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