So the teleport example script for “Following Another Player” in the API at https://developer.roblox.com/en-us/api-reference/function/TeleportService/TeleportToPlaceInstance
is shown below :
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
-- Is this player following anyone?
local followId = player.FollowUserId
-- If so, find out where they are
if followId and followId ~= 0 then
local success, errorMessage, placeId, jobId = pcall(function()
return TeleportService:GetPlayerPlaceInstanceAsync(followId)
end)
if success then
-- Teleport player
TeleportService:TeleportToPlaceInstance(placeId, jobId, player)
end
else
warn("Player " .. player.UserId .. " is not following another player!")
end
end)
I have put this into a Script in the ServerScriptService but it does not seem to be working correctly. I didn’t edit the code at all from the example, the warn portion is working great but when teleporting a player at line 14 TeleportService:TeleportToPlaceInstance(placeId, jobId, player) it gives me the error “Unable to cast string to int64”. What am I missing? Am I supposed to add my own values instead of the variables placeId/jobId/player on line 14? Or do I just need to do some sort of string/int64 conversion within the function? Any help would be greatly appreciated!