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
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.