Value not changing?

Hi everyone, thank you for clicking on my thread :slight_smile:

So I’m trying to make a value decrease whenever I hit a part named “Neck” with swords, and the value doesn’t seem to decrease at all. I get no error in the output, and I have no idea why this is happening. It’s in a local script.

local leftBlade = Character["LeftHand"]:waitForChild("Blade")
local rightBlade = Character["RightHand"]:waitForChild("Blade")

local BladesLeft = script.Config.BladesLeft
local bladesTotal = leftBlade or rightBlade

bladesTotal.Touched:Connect(function(hit)
    if hit.Name == "Neck" then
        BladesLeft.Value = BladesLeft.Value - 1
    end
end)

Any help would be greatly appreciated, thanks :slight_smile:

Is it a LocalScript or a server Script?

1 Like

It’s a local script, but I intend to make it local.

1 Like

It will not replicate to the server then.

1 Like

As @lifacy said, it won’t replicate to the server. So that, you should use a RemoteEvent and change the values at the server :slight_smile:

1 Like