Help Making Working Umbrella Script

I have a acid rain system in game game and I want to make it so when I pull a tool out (in my case an Umbrella) I wont take any damage in the acid rain part.

(still a new scripter any help is appreciated)

Acid Rain Script

local DAMAGE = 3
local INTERVAL = 17/30

local touchingHumanoids = {}

script.Parent.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		touchingHumanoids[humanoid] = true 
	end
end)

script.Parent.TouchEnded:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid then
		touchingHumanoids[humanoid] = nil
	end
end)

while true do
	for humanoid in pairs(touchingHumanoids) do
		humanoid:TakeDamage(DAMAGE)
	end
	task.wait(INTERVAL)
end

Make a if statement to check for the umbrella. Replace the tool_name with whatever the name of the umbrella tool is.

while true do
	for humanoid in pairs(touchingHumanoids) do
		if not humanoid.Parent:FindFirstChild("TOOL_NAME_HERE") then
			humanoid:TakeDamage(DAMAGE)
		end
	end
	task.wait(INTERVAL)
end
1 Like

thanks very much that worked I tried something like that I guess I just typed it wrong

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