Return By Death script
Key RequiredUniversal

Return By Death script

Universal ScriptprideSubaruprideSubaru 2.2K views 1.2K executesUpdated Dec 9, 2025
3.3/ 5(3 votes)
2167% Positive
Lua Script•105 lines (2945 chars)
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local isTeleportEnabled = true 
local lastPosition = nil       

local toggleButton = nil

local function updateButtonDisplay()
    if not toggleButton then return end

    if isTeleportEnabled then
        toggleButton.Text = "RETURN BY DEATH: ON"
        toggleButton.BackgroundColor3 = Color3.fromRGB(0, 170, 0)
        toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    else
        toggleButton.Text = "RETURN BY DEATH: OFF" 
        toggleButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
        toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    end
end

local function toggleTeleport()
    isTeleportEnabled = not isTeleportEnabled
    updateButtonDisplay()
    print("Teleport Toggled. Enabled: " .. tostring(isTeleportEnabled))
end

local function setupGUI()
    local gui = Instance.new("ScreenGui")
    gui.Name = "RespawnToggleGui"
    
    gui.ResetOnSpawn = false 

    gui.Parent = LocalPlayer:WaitForChild("PlayerGui")

    toggleButton = Instance.new("TextButton")
    toggleButton.Name = "ToggleTeleport"
    toggleButton.Size = UDim2.new(0, 250, 0, 40)
    toggleButton.Position = UDim2.new(0.5, -125, 0.05, 0) 
    toggleButton.Font = Enum.Font.SourceSansBold
    toggleButton.TextSize = 18
    toggleButton.BorderColor3 = Color3.fromRGB(27, 42, 53)
    toggleButton.BorderSizePixel = 2
    
    
    toggleButton.MouseButton1Click:Connect(toggleTeleport)
    toggleButton.Parent = gui

    
    updateButtonDisplay()
end


local function onCharacterDied()
    if isTeleportEnabled then
        local character = LocalPlayer.Character
        if character and character.PrimaryPart then
            
            local currentCFrame = character.PrimaryPart.CFrame
            lastPosition = currentCFrame + Vector3.new(0, 0.5, 0)
            print("Player died. Saving position: " .. tostring(lastPosition))

            
            LocalPlayer:LoadCharacter()
        end
    end
end


local function onCharacterAdded(newCharacter)
    
    local rootPart = newCharacter:WaitForChild("HumanoidRootPart", 5)

    if rootPart and lastPosition and isTeleportEnabled then
        
        rootPart.CFrame = lastPosition
        print("Character respawned and teleported back to the last position.")
        
        lastPosition = nil
    elseif not isTeleportEnabled then
         print("Teleport is disabled. Standard respawn behavior followed.")
    end

    
    local humanoid = newCharacter:WaitForChild("Humanoid", 10)
    if humanoid then
        humanoid.Died:Connect(onCharacterDied)
    end
end


LocalPlayer.CharacterAdded:Connect(onCharacterAdded)


if LocalPlayer.Character then
    onCharacterAdded(LocalPlayer.Character)
end


setupGUI()

print("Instant Respawn Script with GUI toggle loaded.")

Features & Information

when u die u go back to the same place where u died.
#script#rbd#roblox#rezero

Community Comments (8)

i_love_scripti_love_scriptDec 9, 2025

Your inspiration is Subaru, right?

Replying to @i_love_script
prideSubaruprideSubaruDec 9, 2025

@i_love_script yes

Replying to @i_love_script
mykpatmykpatDec 12, 2025

@i_love_script yes

atrixatrixDec 9, 2025

is working ?

Replying to @atrix
prideSubaruprideSubaruDec 10, 2025

@atrix yea on lots of games

Flower_boyFlower_boyDec 31, 2025

Love the return by death script, It works on alot of games.

ScriptgoonerScriptgoonerDec 31, 2025

can you make it play THAT sound once u die?

johntheman199johntheman199Jun 29, 2026

Does it work in rivals Roblox

More Scripts for Universal Scripts