Weld boots to players when join

I mistyped it

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)

-- whatever here and ‘char’ is the character’s character model

end)
end)

I put (char) instead of (function(char) on accident

1 Like

So My script looks like this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local LLeg = char["Left Leg"]
		local RLeg = char["Right Leg"]
		local LBoot = game.ReplicatedStorage.WeldObj.LeftBoot:Clone()
		local RBoot = game.ReplicatedStorage.WeldObj.RightBoot:Clone()
		
	end)
end)

and now how Do I put the Left and right boots at each leg position?

Alright looking good

but what is WeldObj?

and there is a thing in CFrame scripting where you can change the primary part of the model and the whole model will be where it is depending on where it was relative to it, i gotta find it real quick

WeldObj Is a folder I made to organize parts. So Models that get welded or will be go into the folder.

Oh ok

and it is
model:SetPrimaryPartCFrame(cf)

But the models must have primaryparts or else it errors

So In the picture I provided in the post at the top there is a part called light grey. Can I set the boots primary to light grey? and how do I set Primary part for it? Since The model is in replicated storage and the script is in workspace?

yes and maybe offset the cframe a bit

and in the Model there is a property called PrimaryPart

1 Like

What you can do is that when the player joins Create a Weld and set it’s part 0 to the Leg and the part 1 to a handle of the boot that surrounds the whole boot as an invisible block. Also you have to weld all the parts of the boot to the handle then.

1 Like

Here is an api reference to welding with code, WeldConstraint | Roblox Creator Documentation. And a YouTube tutorial, [ROBLOX Tutorial] - Welding Script - YouTube.

1 Like

How do I place the boot at the correct leg place? Ive added the primary part? Can I just do position = position?

basically

themodel:SetPrimaryPartCFrame(thelimb.CFrame)

So I did this:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local LLeg = char["Left Leg"]
		local RLeg = char["Right Leg"]
		local LBoot = game.ReplicatedStorage.WeldObj.LeftBoot:Clone()
		local RBoot = game.ReplicatedStorage.WeldObj.RightBoot:Clone()
		
		LBoot:SetPrimaryPartCFrame(LLeg.CFrame)
		RBoot:SetPrimaryPartCFrame(RLeg.CFrame)
		
	end)
end)

Now do I set LBoot.Position = LLeg.Position and RBoot.Position = RLeg.Position?

1 Like

Looks right!

If it looks broken then you can make an invisible part at a desired position and make that the primarypart or you could do the offset thing.

1 Like

So. I added more but it doesn’t weld it to the player or even go to the player model. This is the script:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local LLeg = char["Left Leg"]
		local RLeg = char["Right Leg"]
		local LBoot = game.ReplicatedStorage.WeldObj.LeftBoot:Clone()
		local RBoot = game.ReplicatedStorage.WeldObj.RightBoot:Clone()
		
		LBoot:SetPrimaryPartCFrame(LLeg.CFrame)
		RBoot:SetPrimaryPartCFrame(RLeg.CFrame)
		
		LBoot.Position = LLeg.Position
		RBoot.Position = RLeg.Position
		
		
		local Lweld = Instance.new("WeldConstraint")
		Lweld.Parent = char
		Lweld.Part0 = LLeg
		Lweld.Part1 = LBoot
		
		local Rweld = Instance.new("WeldConstraint")
		Rweld.Parent = char
		Rweld.Part0 = RLeg
		Rweld.Part1 = RBoot
		
	end)
end)

I haven’t scripted with welds in a long time, the only thing that I could think of that might correct it is making the weldconstraints’ parents either the boot primarypart or the players limb

1 Like

I changed the .parent to the Limb but I get this error: Position is not a valid member of Model “LeftBoot” Even if it has a primary part

I’m not sure what was changed to make that happen, but it errored because the script tried to set the position for LeftBoot is the entire model which doesn’t have the position property

Can you paste your new revised script here again please

Here:

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local LLeg = char["Left Leg"]
		local RLeg = char["Right Leg"]
		local LBoot = game.ReplicatedStorage.WeldObj.LeftBoot:Clone()
		local RBoot = game.ReplicatedStorage.WeldObj.RightBoot:Clone()
		
		LBoot:SetPrimaryPartCFrame(LLeg.CFrame)
		RBoot:SetPrimaryPartCFrame(RLeg.CFrame)
		
		LBoot.Position = LLeg.Position
		RBoot.Position = RLeg.Position
		
		
		local Lweld = Instance.new("WeldConstraint")
		Lweld.Parent = LLeg
		Lweld.Part0 = LLeg
		Lweld.Part1 = LBoot
		
		local Rweld = Instance.new("WeldConstraint")
		Rweld.Parent = RLeg
		Rweld.Part0 = RLeg
		Rweld.Part1 = RBoot
		
	end)
end)

I see the issue, you have the part where it says
LBoot.Position = LLeg.Position
RBoot.Position = RLeg.Position

you can remove it because there is already the SetPrimaryPart thing

1 Like