Hi guys! In my gun script, I am checking the players health and checking if it is 0. I then want to change the value in the workspace "AtLeastOneShot" - for some reason it don't change it :( Any ideas? Thanks
HitHumanoid = FindFirstClass(HitObj.Parent, "Humanoid")
HumanoidFound = true
if HitHumanoid.Health > 0 then
if IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
local ChosenDamage = 0
if HitObj.Name == "Head" then
ChosenDamage = S.Damage * RAND(HeadVal, HeadVal + 0.1, 0.01)
elseif HitObj.Name == "Torso" then
ChosenDamage = S.Damage * RAND(ChestVal, ChestVal + 0.1, 0.01)
else
ChosenDamage = S.Damage * RAND(LimbsVal, LimbsVal + 0.1, 0.01)
end
HitHumanoid:TakeDamage(ChosenDamage)
if HitHumanoid.Health == 0 then game.Workspace.AtLeastOneShot.Value = true
end
Not the whole gun script, but the bit needed!
