What are is the other script in the Tsunami also, is the DestroyWeld on touch script the exact same as this:
local function on_touched(hit)
print(hit.Name)
if hit.Name:lower():match("primary") then
for _, p in pairs(hit.Parent:GetChildren()) do
if p:FindFirstChildOfClass("WeldConstraint") then
p:FindFirstChildOfClass("WeldConstraint"):Destroy()
end
end
end
end
script.Parent.Touched:Connect(on_touched)
I’m assuming the part is anchored and that it’s position is being changed in the other script? If so, don’t use onTouched, use
script.Parent:GetPropertyChangedSignal("Position"):Connct(function()
for i,v in ipairs(script.Parent:GetTouchingParts()) do
if v.Name:lower():match("primary") then
for _, p in pairs(v.Parent:GetChildren()) do
if p:FindFirstChildOfClass("WeldConstraint") then
p:FindFirstChildOfClass("WeldConstraint"):Destroy()
end
end
end
end
end)
The problem isn’t really the names, it’s more of that the tsunami doesn’t register or fire the touched function when it is getting touched, but perhaps he can try this code and see if it is working:
script.Parent:GetPropertyChangedSignal("Position"):Connct(function()
for i,v in ipairs(script.Parent:GetTouchingParts()) do
if v.Name:lower():match("primary") then
for _, p in pairs(v.Parent:GetChildren()) do
if p:FindFirstChildOfClass("WeldConstraint") then
p:FindFirstChildOfClass("WeldConstraint"):Destroy()
end
end
end
end
end)
The issue with the script is the conditional statement used to check if the hit part is one of the “Primary” parts. The expression "Primary" or "Primary2" (and so on) always evaluates to "Primary", regardless of the value of the hit part’s name. Therefore, the script will always break the joints of the hit part, regardless of its name.
To fix this, you should use separate conditional statements to check if the hit part’s name is equal to each of the “Primary” names you want to target. Here’s an example:
script.Parent.Touched:Connect(function(hit)
if hit.Name == "Primary" or hit.Name == "Primary2" or hit.Name == "Primary3" or hit.Name == "Primary4" or hit.Name == "Primary5" or hit.Name == "Primary6" or hit.Name == "Primary7" or hit.Name == "Primary8" then
hit:BreakJoints()
end
end)
Ok so I figured out why the Tsunami wasn’t destroying anything and its because the Tsunami Wave Mesh is Anchored idk if this is a Roblox bug cause I don’t quite get why this is happening and I used my Original WaveDestructionScript that I made in the original post anybody know a solution to fix this???
The Original script works just fine its just for some reason the Tsunami wave mesh cant be anchored or welded because for some reason it wont work but when its unanchored and not welded it works it just flings around and stuff and doesn’t stick to the ground…
Anybody know why all the sudden now I cant break joints if the part with the break joints script in it is either welded or anchored…??? pls help!!! or is this a Bug???