Hi, I got this script, and it wont work because it keep giving an error.
local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(3533731366) local players = game.Players:GetPlayers() function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then TS:TeleportToPrivateServer(3533731366, code, [game.Players:FindFirstChild(hit.Parent.Name)]) end end script.Parent.Touched:Connect(onTouched)
if you look at the line that says:
TS:TeleportToPrivateServer(3533731366, code, [game.Players:FindFirstChild(hit.Parent.Name)])
the output keeps putting out that the first [ is not supposed to be there.
Thanks, guy
Short answer: It is supposed to be an array.
An array is constructed like this
array = {'hello', 'hi'}
So your code is supposed to be:
TS:TeleportToPrivateServer(3533731366, code, {game.Players:FindFirstChild(hit.Parent.Name)})
There is a better way of getting the player. This should be your code:
local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(game.PlaceId) -- no need for the id local players = game.Players:GetPlayers() -- useless variable. you should remove it function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then TS:TeleportToPrivateServer(3533731366, code, game.Players:GetPlayerFromCharacter(hit.Parent)) end end script.Parent.Touched:Connect(onTouched)