Teleporting Data With TeleportToPrivateServer not working?

I’m trying to teleport data with TeleportToPrivateServer to the same game, here is my script:

local TeleportService = game:GetService("TeleportService")
local player = script.Parent.Parent.Parent.Parent.Parent -- I am using a GUI to teleport, yes this is a server script.

script.Parent.MouseButton1Click:Connect(function()
    local ReserveServer = TeleportService:ReserveServer(game.PlaceId)
    local teleportData = {
        ReservedServerCode = ReserveServer
    }
    TeleportService:TeleportToPrivateServer(game.PlaceId, ReserveServer, {player}, teleportData)
end)

when I run the script, I get an error saying

Unable to cast value to std::string -- (line 9)

Am I doing something wrong? I have never used teleportData before.

The teleportData part isn’t a string, it’s a table. Use this line instead:

teleportData.ReservedServerCode

Alright, I will try that out. Thanks.