About takedamage distance script

.Touched:connect(function(part)
		if part:IsDescendantOf(Tool.Parent) then return end
		if contains(Knives, part) then return end
		
		local SplashDamage = 150
		local Radius = 49.5
		local GrenadeArmorFactor = 50
		
		local waitvalue = 1 -- Time to wait each time for dealing damge
		local damage = 10 --Damage dealt
		local maxdistance = 20 -- Max studs between the part and the characterChildWhichIsA("Humanoid") and
			for e,char in pairs(workspace:GetChildren()) do
					if char:FindFirstChildWhichIsA(script.Parent.Position - char:WaitForChild("HumanoidRootPart").Position).Magnitude <= maxdistance then
					part.Parent:FindFirstChild("Humanoid"):TakeDamage(damage)
					print((script.Parent.Position - char:WaitForChild("HumanoidRootPart").Position).Magnitude)
				end
			end
		

I don’t understand the part “script.Parent.Position” .you have acquired a location. I will answer if I need more code.

1 Like

If you are talking about the print statement that has “script.Parent.Position” inside of it, then all script.Parent.Position is doing is getting the Position of the BasePart that the script is in.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.