Hey! I'm working on a game but I'm having a problem.
In my game, there's multiple levels which are in different places in the same game, and I have to use a part to teleport the player to the next place. For some reason, it doesn't work. Please help!
The code is as follows:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Players = game:GetService("Players") local teleportPart = script.Parent local targetPlaceID = 8493347085 -- Change this to your place ID -- Require teleport module local TeleportModule = require(ReplicatedStorage:WaitForChild("TeleportModule")) local function onPartTouch(otherPart) -- Get player from character local player = Players:GetPlayerFromCharacter(otherPart.Parent) if player and not player:GetAttribute("Teleporting") then player:SetAttribute("Teleporting", true) -- Teleport the player local teleportResult = TeleportModule.teleportWithRetry(targetPlaceID, {player}) player:SetAttribute("Teleporting", nil) end end teleportPart.Touched:Connect(onPartTouch)
Maybe you should go to Game Settings, then Security, and then enable "Allow Third-Party Teleports". That should fix it.