Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can You help me do this OnClicked To teleport to a place? [Solved]

Asked by
funzrey 58
10 years ago

Alright, Before you say, Oh its easy, just type in command bar, I'm Trying to teleport the player (Note this is a 1 player lobby place) To the place once they click play (This is a guibutton!), Heres what ive tried (I'll explain more after)

local tps = game:GetService("TeleportService")
script.Parent.MouseButton1Down:connect(function() -- New function
    tps:Teleport(8473728, game.Players:GetChildren()) --This is just a example, it does not teleport to the place i want it to yet
end) --Ends the function (Note that the connect is at the beginning.)

Alright, Assigning tps just makes game:GetService("TeleportService"):Teleport(8473728, game.Players.LocalPlayer) shorter Now the :connect, connects the function once the button is pressed, Uh okay, Please answer, (I am not a real noob in roblox, im just using my alt) I've tried the script alot, it wont work for some strange reason. ServerScript Log:

PlayerError: LocalPlayer Is not parent of game.Players (Note that i shortened that to make you understand it easier)

1 answer

Log in to vote
1
Answered by
wrenzh 65
10 years ago

Put this in a LocalScript if it's a one player server so you don't need the second parameter.

tps:Teleport(8473728) would be all that you need.

0
Oh, Well then, Thanks :D funzrey 58 — 10y
1
If your question is solved, please edit the title. If it's not, please tell me and I'll try to help some more. wrenzh 65 — 10y
0
Well still currently not solved, Cause i cannot get it to work even using :GetChildren() Since its a 1 player server. funzrey 58 — 10y
0
What do you mean? Update your question with the updated script, please. wrenzh 65 — 10y
View all comments (8 more)
0
Oh Okay, But you can help me with localscripts since im still using a localscript funzrey 58 — 10y
0
Correcton for im still using above: A Server script funzrey 58 — 10y
0
This is in a GUI, right? Then you can just use a LocalScript. See my edited answer. wrenzh 65 — 10y
0
Okay! Yes its a gui funzrey 58 — 10y
0
Try that. wrenzh 65 — 10y
0
It Works! (Note: I'm Using place universes :3) funzrey 58 — 10y
0
Great! Happy to help. wrenzh 65 — 10y
0
I funzrey 58 — 10y
Ad

Answer this question