Universal Script 📌
4.1k Views
596 Executions

Respawn where you die

Universal Script 📌
mzeen
mzeenFirst script
2 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

Respawn where you die

View Raw
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local deathPosition = nil

local function onCharacterDied()
	local character = player.Character
	if character and character:FindFirstChild("HumanoidRootPart") then
		deathPosition = character.HumanoidRootPart.Position
	end
end

local function onCharacterAdded(character)
	local humanoid = character:WaitForChild("Humanoid")
	humanoid.Died:Connect(onCharacterDied)

	if deathPosition then
		local hrp = character:WaitForChild("HumanoidRootPart")
		hrp.CFrame = CFrame.new(deathPosition + Vector3.new(0, 5, 0))
	end
end

player.CharacterAdded:Connect(onCharacterAdded)
if player.Character then
	onCharacterAdded(player.Character)
end


Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!

More universal scripts

See all
Script hub
3.6M
857.3k
Bumped 2 hours ago
Key System

Script hub

Hall of Fame #6

Verified script badgeFlow Hub | 50 Games | Updated

Universal Script 📌
28.2k
91.1k
Bumped 3 hours ago
Key System
Script hub
4.0M
2.4M
Bumped 5 hours ago

Script hub

Hall of Fame #3

KeylessVerified script badge[KEYLESS] Moondiety Script | 27+ supported Games

Script hub
197.5k
2.1M
Bumped 6 hours ago
Key System

Script hub

#21 this week

Verified script badgeAirflow HUB