Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Humanoid Stays the same after Respawn? [NOT ANSWERED]

In my script it changes the walkspeed and maxhealth of the player. That's good... until the player dies.

So is there any way to keep the same properties in the Humanoid the same? Even after death? (kind of like StarterGear is to the backpack)

I made this script but it doesn't work...

player = script.Parent.Parent.Parent.Parent
character = player.Character 

character:WaitForChild("Humanoid").Died:connect(function()
	Builder = player.Builder
	if Builder.Value == true then
        player.Character.Humanoid.MaxHealth = 200
        player.Character.Humanoid.Health = 200
		player.Character.Humanoid.WalkSpeed = 12
	end
	
	
end)

1 answer

Putting scripts in StarterGui will run for the player every time they spawn.

That being said, maybe put this script inside StarterGui (Or perhaps your own script?)

LocalScript

local player = game.Players.LocalPlayer
local builder = player:WaitForChild("Builder")
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

if builder.Value == true then
humanoid.MaxHealth = 200
humanoid.Health = 200
humanoid.WalkSpeed = 12
end

UPDATE: Very simple edit, just add a conditional statement to check if it's true.

2 comments

0

That script works, but I want the script to run ONLY if they're 'Builder' property is true and only after they die

0

Updated.

This discussion is preserved as it was. New answers, comments, and votes are closed.