Why is my script not running past the Touch function?

Achieve

I’m attempting to make a script that damages a player and breaks the Weld once touched.


Issue

When a player touches the bricks, the Weld doesn’t break and the player doesn’t receive any damage.


Photos

image
image


Script

--[[Made By MillerrIAm]]--
--[Server Variables]--
local stop = false
--[Main Script]--
for _,part in pairs (script.Parent:GetChildren()) do
	local dmg = game.ServerStorage["Damage Values"][script.ValueName.Value].Value
	local plr = part.Parent:FindFirstChild("Humanoid")
	if part:IsA("UnionOperation") or part:IsA("Part") or part:IsA("MeshPart") or part:IsA("CornerWedgePart") or part:IsA("WedgePart") then
			part.Touched:Connect(function(part)
			if plr and plr.PlatformStand then
				if not stop then
					stop = true
					plr.Health = plr.Health -dmg
				end
				if script.Parent:FindFirstChild("WeldConstraint") then
					local Weld = script.Parent.WeldConstraint
					if Weld.Enabled == true then
						Weld.Enabled = false
					end
				end
				wait(3)
				stop = false
			end	
		end)		
	end
end

Thank you for any help you can give me.

Here’s a script you can define the variables

Touchpart.Touched:Connect(function(part)
local hum = part.Parent.Humanoid or nil
hum:TakeDamage(100)
for i,v in pairs(weldPart:GetChildren()) do
if v:IsA("Weld") then
v:Destroy() --breaks welds
end
end
end)

Hope it helps!

1 Like

This script is not compatible with his system.

1 Like

I’m giving this a bump to see if anyone is able to help me.