You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
A script fix that fixes weld with parts that arent touching the “welder” part.
What is the issue? Include screenshots / videos if possible!
I always get a Attempt to call missing method ‘GetPartsInPart’ error when running the game.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Changing arguments, yes.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
if script.Parent:GetConnectedParts():GetPartsInPart()==nil then --Check if welded bricks arent touching and cleans
w:Destroy() --Destroy weld if target is found: Welded, but not touching
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
also @MAXPROFI333 there is a error in the code I think
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsinside = workspace:GetPartsInPart(v)
if #partsInside == 0 then
w:Destroy()
break
end
Got an error. Workspace.WeldPart.Weld:18: Expected identifier when parsing expression, got ‘)’
Listen, the code you made is full of typos like the error and line 3 of the code.
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside == 0 then
w:Destroy()
break
end
script.Parent.Touched:Connect(function(hit)
if hit.Name=="2x1x2" or hit.Name=="3x3x3 Ball" or hit.Name=="2x2x2" or hit.Name=="4x1x2" then
if hit.Parent:FindFirstChild("Humanoid") then
return
end
local w=Instance.new("WeldConstraint")
w.Enabled=true
w.Part0=script.Parent
w.Part1=hit
w.Parent=script.Parent
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside == 0 then
w:Destroy()
break
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Name=="2x1x2" or hit.Name=="3x3x3 Ball" or hit.Name=="2x2x2" or hit.Name=="4x1x2" then
if hit.Parent:FindFirstChild("Humanoid") then
return
end
local w=Instance.new("WeldConstraint")
w.Enabled=true
w.Part0=script.Parent
w.Part1=hit
w.Parent=script.Parent
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside == 0 then
w:Destroy()
break
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Name=="2x1x2" or hit.Name=="3x3x3 Ball" or hit.Name=="2x2x2" or hit.Name=="4x1x2" then
if hit.Parent:FindFirstChild("Humanoid") then
return
end
local w=Instance.new("WeldConstraint")
w.Enabled=true
w.Part0=script.Parent
w.Part1=hit
w.Parent=script.Parent
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside > 0 then
w:Destroy()
break
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Name=="2x1x2" or hit.Name=="3x3x3 Ball" or hit.Name=="2x2x2" or hit.Name=="4x1x2" then
if hit.Parent:FindFirstChild("Humanoid") then
return
end
local w=Instance.new("WeldConstraint")
w.Enabled=true
w.Part0=script.Parent
w.Part1=hit
w.Parent=script.Parent
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside >= 0 then
w:Destroy()
break
end
end
end
end)
script.Parent.Touched:Connect(function(hit)
if hit.Name=="2x1x2" or hit.Name=="3x3x3 Ball" or hit.Name=="2x2x2" or hit.Name=="4x1x2" then
if hit.Parent:FindFirstChild("Humanoid") then
return
end
local w=Instance.new("WeldConstraint")
w.Enabled=true
w.Part0=script.Parent
w.Part1=hit
w.Parent=script.Parent
script.Parent.Anchored = true
hit.Anchored = true
for _, v: BasePart in script.Parent:GetConnectedParts() do
local partsInside = workspace:GetPartsInPart(v)
if #partsInside >= 0 then
w:Destroy()
break
end
end
end
end)