I Was working on a limb mechanic with a tool and i’ve encountered a problem that when I run a weld it will just destroy itself.
I’ve tried using other inbuilt roblox mechanics like attach but it didn’t do anything like the weld did.
Heres the script I wrote:
local UIS = game:GetService("UserInputService")
local char = script.Parent.Parent
local h = char.Humanoid
local anim
UIS.InputBegan:Connect(function(key)
local k = key.KeyCode
if k == Enum.KeyCode.E then
local weld = Instance.new("Weld")
anim = h:LoadAnimation(script.Animation)
anim:Play()
weld.Part0 = script.Parent.Handle
weld.Part1 = script.Parent.Handle.Part
end
end)
Why not just use a WeldConstraint instead of scripting it? Select the Handle first, click the Constraints tab in the Studio Model tab, click on the Weld constraint in the drop-down, then click on the Part. They will be welded as the two Parts sit.
The nice thing about the Constraint weld is if you decide you want to move the Part in relation to the Handle while building, the Weld won’t disappear like a scripted weld.
Yes, it’s that one. If you’ve been a Programmer mostly you should explore the Studio tabs and tools to see what they do. Might save you some time in the future too.