Expected table argument, got nil error

I get this error with my teleport script

local gameid = 127738702996056 

local l__sTeleportService__1 = game:GetService("TeleportService");

local l__sStarterGui__1 = game:GetService("StarterGui");
local l__vPlaceID__1 = tonumber(127738702996056);


game.ReplicatedStorage.TeleportPS.OnServerEvent:Connect(function(player)

	local v9 = game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0
	if v9 then
		print("Player's already in a private server; creating a new one.");
	else
		print("Player's in a public server; creating a private server.");
	end;

	local v10 = l__sTeleportService__1:ReserveServer(l__vPlaceID__1);
	local v11 = game:GetService("Players").LocalPlayer;
	l__sTeleportService__1:TeleportToPrivateServer(l__vPlaceID__1, 127738702996056, v11);
	
	

end)

The Error occurs at the bottom

try replacing

l__sTeleportService__1:TeleportToPrivateServer(l__vPlaceID__1, 127738702996056, v11);

with

l__sTeleportService__1:TeleportToPrivateServer(l__vPlaceID__1, v10, {v11});

this will teleport the player to the correct reserved server (v10)

1 Like
  1. You can’t access the local player from a server script. You instead should use the player argument from the OnServerEvent

  2. You should provide the players as a table, not as an individual object, so it would be something like {player} in place of v11

  3. There’s no point in using unclear variable names, like v9, v10, v11 etc. You may be trying to make it so exploiters can’t tell what’s happening, but all it does is make it harder for you - exploiters can’t see server scripts, and local scripts that they can access don’t contain any of the variable names (hence why exploited scripts always have variables like v1, v2 etc.)

1 Like

Those variables aren’t @XxKawaiiGore’s, they’re a product of decompilation. Decompilation is achieved through the same script injection software exploiters use so game code can be stolen.

TL;DR: @XxKawaiiGore’s either clueless or a skid.

A friend gave me it saying he made it.

So I’m guessing that’s not his… and he stole it :sob:

Yea lol that script look like it came out of an exploit lel but why would he send you a broken script?

Sorry to break it to 'ya. Your friend either claimed to have written someone else’s code, or is a script kiddie. If it’s the latter, the embarrassment is much greater considering the simplicity of the script

1 Like