RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Make a teleporter that teleports when i press e button but i need to have 1 rebirth to teleport"
-- local script local UserInputService = game:GetService("UserInputService") local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local teleportPart = game.Workspace.TeleporterPart local teleportDestination = game.Workspace.TeleportDestination.Position local function onInputBegan(input, gameProcessedEvent) if input.KeyCode == Enum.KeyCode.E and not gameProcessedEvent then local distance = (character.HumanoidRootPart.Position - teleportPart.Position).Magnitude if distance <= 10 and player.leaderstats.Rebirths.Value >= 1 then character.HumanoidRootPart.CFrame = CFrame.new(teleportDestination) end end end UserInputService.InputBegan:Connect(onInputBegan)