So I'm asking that If I use a tool, can I stop taking damage?
COMMUNITY QUESTION
Is there a way to stop/reduce the damage that you're taking when you're using a tool?
2 answers
Yes, there is a way.
Put extra script in the weapons you're using so, if you protect yourself with the tool, said weapons won't damage. Here's an example with the (new) Roblox sword:
--In Sword ModuleScript, replacing the end of Function "Sword:Connect()"
if player.Character.Protected then --You can check if an instance (ex. BoolValue) exists, or always have it on the player and check if it is true, for (literal) damage control
GLib.TagHumanoid(humanoid, myPlayer, 1)
humanoid:TakeDamage(doDamage)
end
Hope i helped! You know what to do from here, i assume.
There is a way to remove the damage taking. If it's like onTouched event, then there sure is.
local user = nil
script.Parent.Equipped:connect(function()
user = script.Parent.Parent
script.Parent.Handle.Touched:connect(function(hit)
if hit.Parent ~= user then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(25)
end
end
end)
end)
That avoids you getting damage, 'cause it detects if it's the user who's being hit, and if it's not, it'd move forward in the script.
This discussion is preserved as it was. New answers, comments, and votes are closed.
