Hi, I was wondering if it is possible to deal less damage the farther away from a gun. here is my script:
script.Parent.Parent.RemoteEvents.Shoot.OnServerEvent:Connect(function(player, FromP, ToP, ToParent)
local Dist = (FromP-ToP).magnitude
print(Dist)
if ToParent:FindFirstChild("Humanoid") then
ToParent.Humanoid:TakeDamage(Dist)
end
end)

2 comments
Might want to look into this: https://www.khanacademy.org/science/electrical-engineering/ee-electrostatics/ee-electric-force-and-electric-field/a/ee-inverse-square-law
I dont know, maybe if you make a value for distance and look for a value for certain distance