I’m trying to make that damages you more the closer you stand to it. I made a script, but it damages you more the further you are away from it.
Code:
local magnitude = (Player.Character.HumanoidRootPart.Position - StandModel.Target.Value.HumanoidRootPart.Position).Magnitude
Maybe you could calculate the damage by dividing some number with the magnitude. That would mean the bigger the magnitude, the smaller the damage.
Your script looks fine, you could do something like so:
if Magnitude <= 20 and Magnitude >= 10 then -- deal less dmg as the player is further away elseif Magnitude < 10 then -- deal more dmg as the player is closer end