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.
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.
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:
Press "File" at the top left.
Press "Publish to Roblox"
Follow any steps, such as filling in the name, and description, if that is the first time.