Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to use Magnitude to inflict damage to players?

I haven't got a script to go with this but I just want to know if it's possible and if it is how? Because I have no clue.

2 comments

1

Sure, hum.Health = hum.Health - (250-(mag*5)). Basically for every stud you're away from the magnitude point, the maximum possible health to reduce gets reduced by 5. If you provide a script I'll be able to help you out more!

0

Ill try to

1 answer

✓ Accepted answer

Yes, it is possible. I'll do some script here with an explanation.

local redpart = Instance.new("Part", workspace)
redpart.BrickColor = BrickColor.Red()
RedPartDoesDamage = coroutine.create(function()
	for _, poss in pairs(workspace:GetChildren()) do
		if poss:FindFirstChild("Humanoid") then
			print("Hi")
			if poss.Torso then
				print("Hi2")
				if (poss.Torso.Position - redpart.Position).magnitude <= 10 then
					print("Hi3")
					while (poss.Torso.Position - redpart.Position).magnitude <= 10 do
						poss.Humanoid.Health = poss.Humanoid.Health - 10%poss.Humanoid.MaxHealth
						wait(1)
					end
				end
			end
		end
	end
end)
script.Parent.MouseClick:connect(function()
	coroutine.resume(RedPartDoesDamage)
end)

This script is basically searching through the workspace for Models with a Humanoid and a Torso inside and then do damage if they're within a distance of 10 Studs or less. You should place it into a ClickDetector.

This discussion is preserved as it was. New answers, comments, and votes are closed.