Welding Script for weapons issues

Hi community.

i am currently using this welding script for my various weapons. The issue i am having after respawn is that for some weapons, parts are missing, for some weapons the movement becomes weird. For eg holding on right click to shift the view while moving ( am using camera 0.5 fixed ), the player flies / cannot move / etc

i think i isolated to the script because if i play around with it, it can become worse like the above happening without a respawn.

tool = script.Parent
handle = tool:WaitForChild("Handle")
Types = {"Part","WedgePart","TrussPart","MeshPart"} 

function Weld(obj)
	local w1 = Instance.new("Weld",handle)
	w1.Part0 = handle
	w1.Part1 = obj
	w1.C0 = handle.CFrame:inverse()
	w1.C1 = obj.CFrame:inverse()
	
	obj.Anchored = false
end

function Confirming()
	for _,part in pairs(tool:GetChildren()) do
		if part.Name ~= "Handle" then
			for _,type in pairs(Types) do
				if part:IsA(type) then
					Weld(part)
				end
			end
		end
	end
	handle.Anchored = false
end
Confirming()

It could be that the joint break and parts are then falling out the map, the simplest soloution I can think of is to give the weapon a new model when respawning or to just replace it entirely with a new one.

Even with death detection there would be an ammount of movement from said parts resulting in the model eventually being disfigured.

May I know how can I do that? Thanks

Do you mean destroy and clone?

Destroy and clone would replace it.

If there is inventory saving or anything be sure this is done properly

The thing is I am doing it now.

Upon char added, i run a function to delete all non starter pack stuff and clone / equip the custom weapon again.

Unless I need to add a manual delay?

So long as they are removed then added in again there shouldnt be any issues, any scripts would be replicated so it would run as normal.

It might be worth making a array with the objects (the weapons) so you can remove all their weapons and then clone from the array to clear things up if there are any issues or bugs.

Ok. I fear this will be one of those tough bugs lol

Just to confirm , the weld script checks out fine?

Yes it seems good, its just creating it, connecting the parts and holding them in their current positions with :inverse()

1 Like

@minimic2002 hey buddy , i tried just to rule it out but it worked. just a wait will do!

So now i add a wait(0.1) before i run the process of equip. How strange lol