I have a teleporter that teleports to another game, but for some reason it only works in private servers, I’ve checked the script, I am still learning Lua so maybe I missed something. Here’s the code:
local telePart = script.Parent
local TeleportService = game:GetService('TeleportService')
local placeID = 5641285560
local canTeleport = true
local function otherGame(otherPart)
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canTeleport then
canTeleport = false
TeleportService:Teleport(placeID, player)
end
end
telePart.Touched:Connect(otherGame)
You’ve got the main basics down, there is just a couple errors that I noticed in your script, try this:
local telePart = script.Parent
local TeleportService = game:GetService("TeleportService")
local placeID = 5641285560
local canTeleport = true
local function otherGame(otherPart)
local hum = otherPart.Parent:FindFirstChild(“Humanoid”)
local plr = game.Players:GetPlayerFromCharacter(hum.Parent)
if plr and canTeleport then
canTeleport = false
TeleportService:Teleport(placeID, plr)
wait()
canTeleport = true
end
end)
telePart.Touched:Connect(otherGame)
You can’t get do GetPlayerFromCharacter(hum) with a humanoid. You need to use a Character in order to use this function. Try doing GetPlayerFromCharacter(otherPart.Parent) instead.
I’m not testing in studio, I’m testing in a test place via roblox which isn’t the starter place and the starter place is public. The test place is also public.
local telePart = script.Parent
local TeleportService = game:GetService('TeleportService')
local placeID = 5641285560
local canTeleport = true
local function otherGame(otherPart)
local player = game.Players:FindFirstChild(otherPart.Parent.Name)
if player and canTeleport then
canTeleport = false
TeleportService:Teleport(placeID, player)
end
end
telePart.Touched:Connect(otherGame)