Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

12 comments

0

Oh, Well then, Thanks :D

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.

0

Well still currently not solved, Cause i cannot get it to work even using :GetChildren() Since its a 1 player server.

0

What do you mean? Update your question with the updated script, please.

0

Oh Okay, But you can help me with localscripts since im still using a localscript

0

Correcton for im still using above: A Server script

0

This is in a GUI, right? Then you can just use a LocalScript. See my edited answer.

0

Okay! Yes its a gui

0

Try that.

0

It Works! (Note: I'm Using place universes :3)

0

Great! Happy to help.

0

I

This discussion is preserved as it was. New answers, comments, and votes are closed.