Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Configuration
- local teleportPart = script.Parent -- The part representing the teleport pad
- -- Teleport Function
- local function teleportPlayer(part, player)
- -- Check if the part touched is the teleport pad
- if part == teleportPart then
- -- Get the desired teleport location
- local teleportDestination = Vector3.new(x, y, z) -- Replace x, y, z with the destination coordinates
- -- Teleport the player to the destination
- player.Character.HumanoidRootPart.CFrame = CFrame.new(teleportDestination)
- end
- end
- -- Player Touch Event
- local function onPlayerTouch(part)
- -- Get the player who touched the part
- local player = game.Players:GetPlayerFromCharacter(part.Parent)
- -- Check if the player exists and is alive
- if player and player.Character and player.Character:FindFirstChild("Humanoid") and player.Character.Humanoid.Health > 0 then
- teleportPlayer(part, player)
- end
- end
- -- Connect the touch event
- teleportPart.Touched:Connect(onPlayerTouch)
Advertisement
Add Comment
Please, Sign In to add comment