Hello everyone,
I’m trying to make a system where by touching a part, the players’ gun damage increases/decreases.
The script works fine whenever the Value is positive, but whenever it is negative, the damage value doesn’t change at all.
I’ve tried doing this:
player.weaponStats.Damage.Value = newValue.Value
to see if the damage value even changes when the newValue.Value is negative, but nope. It stays at the default value.
I’m really lost here but I feel like I’m missing something obvious 
game.Players.PlayerAdded:Connect(function(player)
local part = script.Parent.Parent
local SurfaceGui = script.Parent
local TX = script.Parent.TextLabel
local MinusPlus = math.random(1,2)
local newValue = TX.New
local active = false
newValue.Value = math.random(-150,300)
if newValue.Value < 0 then
TX.Text = newValue.Value
part.Color = Color3.fromRGB(170, 0, 0)
else
TX.Text = "+" .. newValue.Value
part.Color = Color3.fromRGB(85, 170, 0)
part.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not active then
active = true
player.weaponStats.Damage.Value += newValue.Value
wait(5)
active = false
end
end
end)
end
end)
