Hello! So I actually made this script in less than half an hour with trial and error and I finally got it to work! Let me explain: So basically when I equip the tool, a boot attaches to the players leg.(it is a model) And then I click and the other leg is given a boot.(I didn't know how to make the complex function work within the same equip function). This works great! But there is a problem; The boots are rotated 90 degrees. Is there a way I can rotate the whole model 90 degrees so that it is facing the front of the player? I have looked around but found no reasonable answer. Here is the script:
Tool = script.Parent function Equipped(Equipped) local assetId = 250706765 Asset = game:GetService("InsertService"):LoadAsset(assetId) Asset.Parent = Tool Asset.Boot2:MoveTo(Tool.Parent:FindFirstChild("Left Leg").Position) local w = Instance.new("Weld") w.Parent = Asset.Boot2.Base w.Part0 = Asset.Boot2.Base w.Part1 = Tool.Parent:FindFirstChild("Left Leg")--Somewhere around here I need the model to rotate 90 degrees. end function onActivated() local assetId = 250706765 Asset = game:GetService("InsertService"):LoadAsset(assetId) Asset.Parent = Tool Asset.Boot2:MoveTo(Tool.Parent:FindFirstChild("Right Leg").Position) local w = Instance.new("Weld") w.Parent = Asset.Boot2.Base w.Part0 = Asset.Boot2.Base w.Part1 = Tool.Parent:FindFirstChild("Right Leg")-- same thing around here end Tool.Equipped:connect(Equipped) Tool.Activated:connect(onActivated)
You don't have to rotate the model for this.. on line 9
and line 21
then you can just set the C0 properties of the welds.
The C0 Property of a weld defines it's offset from the Part1 Property. Use this to rotate the weld, rather than the model
local w = Instance.new("Weld",Asset.Boot2.Base) w.Part0 = w.Parent w.Part1 = Tool.Parent:FindFirstChild("Left Leg") --Set the 'C0' property to rotate the weld. w.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0) --[[The 'CFrame.new(0,0,0) is the studs offset. Since we don't want the boot to move away from the initial weld spot then we leave that at the origin. And CFrame.Angles will rotate it. If it doesn't rotate it correctly(e.g. not the way you want, but nonetheless rotates) then just mess around with the axises and numbers. ]] end local w = Instance.new("Weld",Asset.Boot2.Base) w.Part0 = w.Parent w.Part1 = Tool.Parent:FindFirstChild("Right Leg") w.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(90),0) end