Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Humanoid Stays the same after Respawn? [NOT ANSWERED]

Asked by 10 years ago

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

Log in to vote
0
Answered by
Discern 1007 Moderation Voter
10 years ago

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.

0
That script works, but I want the script to run ONLY if they're 'Builder' property is true and only after they die SpazzMan502 133 — 10y
0
Updated. Discern 1007 — 10y
Ad

Answer this question