Hmm, would not agree, first of all a character dying a 100 times is not much, secondly setting the health to 50 isn’t very intensive. Another answer is that you can simply disconnect the event once the player dies.
You would have to save whatever you want to save in a seperate folder or clone it, and teleport the player back on respawn, it is currrently impossible to revivie a player
THOUGH ive never tested you might be able to change the state of player from died
Something like that ^
local deathPositions = {} -- Place where we save our positions
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
deathPositions[player] = Vector3.new()
player.CharacterAdded:Connect(function(char)
char.Humanoid.Died:Connect(function()
deathPositions[player] = char.HumanoidRootPart.Position + Vector3.new(0, 1, 0)
end)
end)
player.Chatted:Connect(function(msg)
local split = string.split(msg, " ")
local command, destPlayer = split[1], split[2] and Players:FindFirstChild(split[2]) or player
if command == "!revive" then
if destPlayer then
destPlayer:LoadCharacter()
destPlayer.Character:SetPrimaryPartCFrame(CFrame.new(deathPositions[destPlayer]))
else
player:LoadCharacter()
player.Character:SetPrimaryPartCFrame(CFrame.new(deathPositions[destPlayer]))
end
end
end)
end)
4 Likes
Quick question where would this script go? And is it a script or local script.
You must create a script and put it at ServerScriptService
1 Like