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
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
|
| 25 Nov 2015 08:53 PM |
| It doesn't give the player as a parameter of MouseButton1Click. |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
Pen54321
|
  |
| Joined: 11 Jul 2012 |
| Total Posts: 8894 |
|
| |
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 26 Nov 2015 03:03 PM |
| local player = game.Players.LocalPlayer |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 26 Nov 2015 03:06 PM |
| remove the 'player' from here: function(player) |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 26 Nov 2015 03:09 PM |
Maybe you're testing it in studio?
-wiki before u forum |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 26 Nov 2015 03:12 PM |
Is it a LocalScript?
-wiki before u forum |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 26 Nov 2015 03:12 PM |
...
Anything with client must be local... |
|
|
| Report Abuse |
|
|
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 |
|
|