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

I made this script that gives you a helmet if a bool value is set to true. But there is a problem?

Asked by
d3nton 19
3 years ago

Ok so I made this script that gives you a helmet if a bool value is set to true. But the problem is even when I set the bool value to false and reset my character it still gives me the sigil helm. I've been trying to find ways to prevent this but I haven't been able to. Here is my code:

function makemotor(parent, p0, p1, c0, c1)
    local wel = Instance.new("Motor6D")
    wel.Part0 = p0
    wel.Part1 = p1
    wel.C0 = c0
    if c1 ~= nil then
        wel.C1 = c1
    end
    wel.Parent = parent
    return wel
end

cf = CFrame.new
ang = CFrame.Angles
rd = math.rad
rd2 = math.random

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
        chr.Archivable = true
        local human = chr["Humanoid"]
        local head = chr["Head"]
        local human = chr["Humanoid"]
        local torso = chr["Torso"]
        local rightarm = chr["Right Arm"]
        local leftarm = chr["Left Arm"]
        local rightleg = chr["Right Leg"]
        local leftleg = chr["Left Leg"]

        local data = plr:WaitForChild("Data")
        local SigilHelm = data:WaitForChild("SigilHelm")
        local Stand = chr:WaitForChild("Stand") -- Waiting for the stand


        if SigilHelm.Value == true then
            local helmet = game.ServerStorage.SigilHelm:Clone()
            helmet.Parent = chr
            makemotor(head, head, helmet, ang(rd(0), rd(0), rd(0)) * cf(0, 0.4, 0.2), ang(0, 0, 0))
            chr.Humanoid.MaxHealth = chr.Humanoid.MaxHealth * 1.3
            chr.Humanoid.Health = chr.Humanoid.MaxHealth
            for _, n in pairs(chr:GetChildren()) do
                if n.ClassName == "Accessory" or n.ClassName == "Hat" then
                    n:Destroy()
                end
            end
        end
    end)
end)

Answer this question