Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Weld Remover Script only works in Roblox Studio.. Any help?

Solved, but doesnt work in a server..

while true do
		if script.Parent:FindFirstChild("Weld") then
		
			script.Parent:FindFirstChild("Weld"):remove()
			
	end
	wait(1.3)
	end

It doesn't remove welds in a server, but works fine in roblox studio.

Original post:

repeat wait() until
script.Parent:FindFirstChild("Weld") == true

if script.Parent:FindFirstChild("Weld") == true then
	script.Parent.Weld:remove()
end

I am trying to implement the classic grab tool in my game, but it makes things stick to walls. At first I thought it was because of it being anchored after grabbed, but its just welds.

Now I am trying to figure out how to make a script that could remove those welds.

2 answers

local tool = script.Parent

tool.DescendantAdded:Connect(function(descendant)
	if descendant:IsA("Weld") then
		descendant:Destroy() -- remove is deprecated so use destroy instead
	end
end)

The above script will remove any instance thats gets parented to the tool that is a weld. But you might wanna, fix the issue thats causing the welds instead.

4 comments

0

Thanks for that

0

It works, but once again, in a server it doesnt work..

0

What do you mean? ingame? make sure the server you are testing in is the latest version and not an old one

0

Yeah. And I am making sure it is the latest.

Add a Script under the model.

This script goes through all the Descendants of the part and destroys any welds.

--2Loos' WeldBreaker script.
for i,v in pairs(script.Parent:GetDescendants()) do --Returns all descendants of the parent in a table.
	if v:IsA("WeldConstraint") or v:IsA("Weld") then --Looks only for welds.
		v:Destroy() --Destroys weld.
	end
end

Make sure you publish the game! This is a common issue! Please take a look at this article if you're unsure how to!

Steps to publish:

  1. Press "File" at the top left.
  1. Press "Publish to Roblox"
  1. Follow any steps, such as filling in the name, and description, if that is the first time.

This discussion is preserved as it was. New answers, comments, and votes are closed.