Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago
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.

0
Thanks for that Nath390Fish 19 — 3y
0
It works, but once again, in a server it doesnt work.. Nath390Fish 19 — 3y
0
What do you mean? ingame? make sure the server you are testing in is the latest version and not an old one VerdommeMan 1479 — 3y
0
Yeah. And I am making sure it is the latest. Nath390Fish 19 — 3y
Ad
Log in to vote
0
Answered by
2Loos 168
3 years ago

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.

  2. Press "Publish to Roblox"

  3. Follow any steps, such as filling in the name, and description, if that is the first time.

Answer this question