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)