Background: There are 2 string values inside of this script. one is the regular damage and one is the critical damage value.
This script is supposed to make you deal damage regular damage, or critical but it's not working
script.Parent.Touched:Connect(function(hit) local DmgValues = script.Dmg.Value and script.DmgCritical.Value local char = hit.Parent local hum = char:FindFirstChild("Humanoid") local criticalpicked = math.random(1, #DmgValues) if criticalpicked == 1 then if hum and char.Name ~= script.Parent.Parent.Name then hum.Health = hum.Health - criticalpicked script.Disabled = true wait(0.5) script.Disabled = false end end end)
local DmgValues = script.Dmg.Value and script.DmgCritical.Value
and
doesn't work like that. and
is for conditions, like "if this is true and that is true." You want to use an array.
local DmgValues = {script.Dmg.Value, script.DmgCritical.Value}
Also note that criticalpicked = math.random(1, #DmgValues)
is just going to equal 1 or 2. To actually get the right amount of damage, you have to do DmgValues[criticalpicked]