Hello everyone, I've made a script that would teleport players to another game that is apart of the starter place but it ain't working. Any help?
Code:
local TeleportService = game:GetService("TeleportService") local TS = game:GetService("TeleportService") local Players = game:GetService("Players") local code = TS:ReserveServer(5488852205) function onPartTouch(otherPart) local player = game.Players:GetPlayerFromCharacter(otherPart.Parent) if player then TS:TeleportToPrivateServer(5488852205,code,player) end end script.Parent.Touched:Connect(onPartTouch)
The error that is shown on /console:
07:02:27 -- Unable to cast value to Objects Stack Begin Script 'Workspace.TeleporttoCabin.5.hello.script', Line 11 - function onPartTouch Stack End
Any support would be appreciated, thanks!
The third parameter for this function has to be a table which would be the player(s) that would be teleported to the private server. You can simply put 'player' into a table by just doing TS:TeleportToPrivateServer(5488852205, code, {player})
.