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

Help me out, please?

Asked by 8 years ago

Hello! I'm making a game. First - I create a place using the script. (this is, by the way, in a TextButton) Next, I attempt to teleport them. THAT'S where the problem begins. Any ideas?

function onClick()
    game:GetService("AssetService"):CreatePlaceAsync("Turismo", 124352923, "no")
    game:GetService("TeleportService"):Teleport(124352923, game.Players:GetChildren())
end
script.Parent.MouseButton1Click:connect(onClick)

1 answer

Log in to vote
0
Answered by
Teeter11 281 Moderation Voter
8 years ago
function onClick()
    game:GetService("AssetService"):CreatePlaceAsync("Turismo", 124352923, "no")
    game:GetService("TeleportService"):Teleport(124352923, game.Players:GetChildren())
end
script.Parent.MouseButton1Click:connect(onClick)

Your problem is in the 3rd line.

Your getting a table of the children in players. You want to get a specific player. Put this code into a localscript.

function onClick()
    game:GetService("AssetService"):CreatePlaceAsync("Turismo", 124352923, "no")
    game:GetService("TeleportService"):Teleport(124352923, game.Players.LocalPlayer)
end
script.Parent.MouseButton1Click:connect(onClick)

Now im not sure if youre trying to teleport all the players in the server. (since you used :GetChildren())

Heres a guide on teleport service

Comment below if i helped!

Ad

Answer this question