How can I weld parts to a model using weld constraints via a localscript?

Hello, I’m trying to make a dead eye system similar to the one in rdr2 because im bored, but I tried to make the tagging system, and it works somewhat how i want it, except the areas where you tag just fall, ill add some gyazo gifs of what i want it to do vs what it actually is doing, the code is real simple because im too lazy to make it complicated

local player = game.Players.LocalPlayer
local mouse = player:GetMouse() 
local tag = game.ReplicatedStorage:WaitForChild("tag")

script.Parent.Activated:Connect(function()
	print('uwu')
	local hit = mouse.Target
	print(hit)
	
	if mouse.Target.Parent:FindFirstChild("Humanoid") then
		print('humanoid')
		local humanoid = mouse.Target.Parent.Humanoid 
		local cframe = mouse.Hit
		local weld = Instance.new("WeldConstraint") 
		local clone = tag:Clone()
		print(cframe)
		
		clone.Parent = workspace.LocalTags
		clone.CFrame = cframe
		clone.Hit.Value = mouse.Target
		print(clone.Hit.Value)
		
		weld.Part0 = mouse.Target
		weld.Part1 = clone
		weld.Parent = clone
	end
end)

The welding part is at the end,

anyways here are the gifs

What I want it to do: https://gyazo.com/9de0f90cddedad5784c860fd0467bbda

What its doing: https://gyazo.com/34981f59bd92193717db6a3a698e1d92

(the difference is that its anchored but i dont want it to be anchored so other players can move around)

oh btw incase you wanted to know the script is client sided inside of a tool

thanks for reading

3 Likes

Yes you can weld it to player’s primary part(HumanoidRootPart), though i would advice setting the density to 0 before doing this because if you don’t have less density it may affect player movement.

what do u mean density?

sfgnjsfjdsifsjfhsuoifds

there is an option called custom physical properties under every basepart and meshpart, and under custom physical properties you have an option called Density.

Though changing the density won’t have much effect i would advice you to lower it.

1 Like

sorry i had to sleep last night, ill lower it and see what happens rn then just edit this message with the results

edit: ok so i looked into the properties tab and didnt find anything like that, and i tried printing it through the command bar to see if its just invis like cframe, and it errored

Density is not a valid member of Part "ReplicatedStorage.tag"

and yea its a basepart its just a part with a billboard on it

incase youre wondering this is what i typed

print(game.ReplicatedStorage.tag.Density)

literally i dont know what i did but all i did was change mouse.Target to hit cuz i had a variable for it and all of a sudden the welds are working lol, sorry for posting this i have no idea why it wasnt working last night

1 Like

Oh it’s an property which you must enable to activate.

You will find an option called CustomPhysicalProperties under the part, if you turn that on, you’ll be able to see options like density elasticity etc.

oh i see, thanks!!!