Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[RESOLVED] How to rotate a part affected by a weld ?

Asked by 5 years ago
Edited 5 years ago

I tried rotating a part that is affected by aweld but it didnt work.

Here is my script :

local weldPos = 0
local rot = 0
for i=1,6 do
    weldPos = weldPos - 0.035
    rot = rot - 15
    weld.C0 = circle.CFrame:inverse() * player.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,weldPos):inverse() * CFrame.Angles(math.rad(0), math.rad(0), math.rad(rot)) -- Everything except the CFrame.Angles work. I just cant find a way to rotate the part
    wait()
end

Here are the weld properties :

local circle = game.Workspace.Part
weld.Part0 = circle
weld.Part1 = player.Character.HumanoidRootPart
weld.C0 = circle.CFrame:inverse() * player.Character.HumanoidRootPart.CFrame * CFrame.new(1.35,1.50,-2):inverse()

As you can see, i want to rotate the circle, even though he's using a weld, but it doest work

Gif of what is happening : https://gfycat.com/ObviousYearlyGraysquirrel (Normally, the square is in front of the player's hand, but with the CFrame.Angles, it's not the same thing)

0
can you include a gif/img of what is happening? User#5423 17 — 5y
0
I added one NotZuraax 68 — 5y
0
If it had worked, the square would have rotated without moving NotZuraax 68 — 5y
0
Should you not be using the players right arm CFrame and not the roop part? User#5423 17 — 5y
View all comments (5 more)
0
If i used the arm cframe, it don't always spawn in front of the player, sometimes to the left or to the right.... it's very randomly NotZuraax 68 — 5y
0
Also, when i use the Right upper arm cframe, the square is up the arm, facing the sky (and i dont know how to rotate it, that's why i asked this question) NotZuraax 68 — 5y
0
I think this is causd by the parts rotation. I would have the part setup like https://gyazo.com/cf3f5ea6ec7a36f10a1e8dd4c4ec5b51 User#5423 17 — 5y
0
Then apply any CFrame logic from that with the roation of the part being last. User#5423 17 — 5y

Answer this question