Hi, I wanted to know how to fix this script I made to learn how to use TeleportService. By the way, if you want to see the video I used to learn about Teleport Service, here's the link:
I also tested in the Roblox application as it doesn't work in Roblox Studio because of safety reasons. Here is the script.
Script:
local TS = game:GetService("TeleportService") local part = script.Parent part.Touched:Connect(function(hit) local human = hit.Parent:FindFirstChild("Humanoid") local reserveServerCode = TS:ReserveServer(7107353539) if human then local character = hit.Parent local player = game.Players:GetPlayerFromCharacter(character) local success, errormessage = pcall(function() TS:TeleportToPrivateServer(7107353539, reserveServerCode, player) end) end end)