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

Is there a way to change the rotation of an object welded to a player?

Asked by 6 years ago
Edited 6 years ago

I'm trying to make a game where the player has electric rods, and battles other players, so I need to know if there is a way you change the rotation of a welded Item after it's already been welded, without changing the rotation of the player.

2 answers

Log in to vote
0
Answered by 6 years ago

Well if you are using welds then use the property C0, example, you have 2 bricks, and then you have a script and the script is like this, also the bricks are inside the workspace and named 1 and 2

local weld=Instance.new("ManualWeld")

weld.Parent=workspace.1--Needs a parent otherwise wont work

weld.Part0=workspace.1--Binds the weld to part0
weld.Part1=workspace.2--Binds the second part and welds them togheter

weld.C0=CFrame.new(2,0,0)--This is the CFrame property and how they are welded in pos.

--Now the weld is done. We just have to make a function
workspace.1.Touched:connect(function()--Makes a function when its touched, it will rotate
    for r=1,180 do
        weld.C0=CFrame.Angle(0,r,0)
    end
end

so what we created is a function so when the part is touched it will spin, note that the second part does not spin because of its just a property of Part0 not Part1, so therefor, use C0, if you want to rotate the second part it is C1 Remember that the code C0 is a property of CFrame and not Vector3

Hope you learned something

0
Well I already have it welded, I just wanna know how to change the rotation after it's been welded ventrixion 27 — 6y
0
Ohh, The C0 Property, after the weld.Part0 and weld.Part1 use weld.C0=CFrame.Angle(<Angle-Number>,<Angle-Number>,<Angle-Number>) VenomiZeD_VamqireXz 111 — 6y
0
Well I mean like, on the click of a button. ventrixion 27 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
mse.Button1Down:Connect(function()
    script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0, math.rad(90), 0)
end)

Note that the part has already been welded to the hand

Answer this question