Unable to catch instance to int64 while using TeleportService

Does anyone know why this code keep giving the error “unable to catch instance to int64”
Basically I was just using a system where you can type the placeid into a textbox

I tried using tonumber() but it only give the Argument 1 missing or nil

Server Script:

local TP = game:GetService("TeleportService")
local Remote = game.ReplicatedStorage.TeleportRequest
local Remote2 = game.ReplicatedStorage.TeleportResult

local function OnEvent(Plr, PlaceID)
	local success, result
	
	success, result = pcall(function()
		return TP:TeleportAsync(PlaceID, Plr)
	end)
	if success then
		Remote2:FireClient(Plr, success)
	else
		Remote2:FireClient(Plr, result)
	end
end

Remote.OnServerEvent:Connect(OnEvent)

Local Script:

local Remote = game.ReplicatedStorage.TeleportRequest
local Remote2 = game.ReplicatedStorage.TeleportResult
local Plr = game.Players.LocalPlayer
local Button = script.Parent
local PlaceID = script.Parent.Parent.TextBox.Text

local function OnActi()
	Remote:FireServer(PlaceID)
end

local function Result(log)
	print(log)
end

Button.MouseButton1Click:Connect(OnActi)
Remote2.OnClientEvent:Connect(Result)

Which line is this happening on?

TeleportAsync requires a player table by the way

return TP:TeleportAsync(PlaceID, {Plr})
1 Like

The problem I think is using the text in the textbox for the placeid. If I just leave it like how it was and let Teleport() handle the number, it will return “unable to catch instance to int64”. However, if I try converting the string to number first by using tonumber(), even if there is only numbers in the textbox, it will still say “Argument 1 missing or nil”

nevermind my bad I realized that I didn’t update the PlaceID function inside a LocaScript when the button is triggered