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

Health script can't find the values in players that joined?

Asked by 1 year ago

This script works sometimes and throws an error saying the values aren't in the player when they are.

local player = game:GetService("Players")
local creature = require(game.ReplicatedStorage.creature)


player.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(character)
        --local creature = plr.isvamp.vampt

        local hum = character:FindFirstChild("Humanoid")
        if plr:WaitForChild(plr.isvamp.vampt.Value) == "tier1" then
            hum.MaxHealth = creature.Vampire.tier1.Health
            hum.Health = creature.Vampire.tier1.Health
        elseif plr:WaitForChild(plr.isvamp.vampt.Value) == "tier2" then
            hum.MaxHealth = creature.Vampire.tier2.Health
            hum.Health = creature.Vampire.tier2.Health
        elseif plr:WaitForChild(plr.isvamp.vampt.Value) == "tier3" then
            hum.MaxHealth = creature.Vampire.tier3.Health
            hum.Health = creature.Vampire.tier3.Health
        end
    end)
end)
0
Next time you post a question which involves error, please do give the actual error as well SuperSamyGamer 316 — 1y

Answer this question