How to orient the shoes in the direction the player is facing

Hello devs!

I have problem with rotating shoes.

I want to make something like this:

but normally it looks like this:

Here is script:

--[[Equiping Shoes]]--

--------------------------------------------------------

local function checkShoes()
	for i, v in pairs(Worlds:GetDescendants()) do
		if v:FindFirstChild("Shoes") then
			return true
		end
	end
end

--------------------------------------------------------

local function equipShoes(plr, v)
	local char = plr.Character
	local hum = char:WaitForChild("Humanoid")
	if Equiped_Shoes ~= Max_Equiped_Shoes then
		Equiped_Shoes = 1
		local shoes = v:Clone()
		shoes.Parent = char		

		local LeftWeld = Instance.new("WeldConstraint")
		LeftWeld.Part0 = shoes.Left
		LeftWeld.Part1 = char.LeftFoot
		LeftWeld.Parent = shoes.Left

		local RightWeld = Instance.new("WeldConstraint")
		RightWeld.Part0 = shoes.Right
		RightWeld.Part1 = char.RightFoot
		RightWeld.Parent = shoes.Right	

		shoes.Left.CFrame = char.LeftFoot.CFrame 
		shoes.Right.CFrame = char.RightFoot.CFrame 
		
		for i, parts in pairs(shoes:GetDescendants()) do
			if parts:IsA("MeshPart") or parts:IsA("Part") then
				parts.Anchored = false
				parts.CanCollide = false
			end
		end

		if shoes.Weight.Value > plr.leaderstats.Speed.Value then
			hum.WalkSpeed = 0
		elseif shoes.Weight.Value <= plr.leaderstats.Speed.Value then
			hum.WalkSpeed = 16
		end

		for i, EndPart in pairs(Worlds:GetDescendants()) do
			if EndPart.Name == "EndHitbox" then
				EndPart.Touched:Connect(function(hit)
					local plr = Players:GetPlayerFromCharacter(hit.Parent)
					if plr then
						if shoes then
							shoes:Destroy()
							if char:FindFirstChild("Energy") then
								if MPS:UserOwnsGamePassAsync(plr.UserId, VipPassId) then
									plr.leaderstats.Energy.Value += char.Energy.Value * plr.Rebirth.EnergyR.Value * 1.25 * plr.ValuesFolder.Multiplier1.Value
									plr.LvlFolder.Xp.Value += char.XpValue.Value * 1.5
								else
									plr.leaderstats.Energy.Value += char.Energy.Value * plr.Rebirth.EnergyR.Value * plr.ValuesFolder.Multiplier1.Value
									plr.LvlFolder.Xp.Value += char.XpValue.Value
								end
							end	
							hum.WalkSpeed = 16
							Equiped_Shoes = 0
						end
					end
				end)
			end
		end
	end
end


--------------------------------------------------------

for i, v in pairs(Worlds:GetDescendants()) do
	if checkShoes() then
		if v.Name == "Shoe" then
			v.Hitbox.PromptObject.Triggered:Connect(function(plr)
				equipShoes(plr, v)
			end)
		end
	end
end

1 Like

Any help?
I am bad at CFrames.

1 Like

Are the shoes a model?

If yes, simply use the :SetPrimaryPartCFrame() function

You can use Rigid constraint if you want to avoid weld maths, it’s also better as it uses attachments to visualize the offsets to position it properly.