Unable to cast instance to int64 error

I need help with something. I have a script that when you click the button you teleport to another place inside the game and when i click it i get this error can you guys help me?


local player = game.Players.LocalPlayer
local TS = game:GetService("TeleportService")
local Container = script.Parent.Parent.Parent
local GameID = Container.GameId.Value
script.Parent.MouseButton1Click:Connect(function()

	TS:Teleport(Container.GameId, player)
end)

The second parameter is supposed to be the player’s UserId

TS:Teleport(Container.GameId, player.UserId)

I tired that and i got another error “unable to cast instance to object”

so i tried another way and it tries to teleport but the error says invalid id 0 even tho the id is correct

local player = game.Players.LocalPlayer
local TS = game:GetService(“TeleportService”)
local Container = script.Parent.Parent.Parent
local GameID = Container.GameId.Value
script.Parent.MouseButton1Click:Connect(function()

TS:Teleport(GameID, player)

end)

this is the one with the invalid id

TS:Teleport(Container.GameId.Value, player.UserId)
1 Like

It worked! thank you so much!!!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.