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

How do I make my mesh part rotate?

Asked by 3 years ago

Basically I have been having this issue where a mesh part in my game will not rotate when a script tells it to.

I have a part, when you press E it summons in front of you and it goes flying foward using body velocity.When that part is touched another part is summoned right where that part was and it has to be rotated exactly as the part that was flying.The thing is though is that it goes to the position but doesnt rotate.All of this is done on a normal script and I do not recieve any errors.

I have tried doing this


local KatanaSliceEffect = game.ServerStorage.Effects["KatanaSliceEFFECT"]:Clone() KatanaSliceEffect.Parent = workspace KatanaSliceEffect.CFrame = CFrame.new(katanaSlash.Position) * CFrame.Angles(math.rad(katanaSlash.Orientation.X),math.rad(katanaSlash.Orientation.Y),math.rad(katanaSlash.Orientation.Z)) KatanaSliceEffect.Anchored = true

I have also tried doing this


local KatanaSliceEffect = game.ServerStorage.Effects["KatanaSliceEFFECT"]:Clone() KatanaSliceEffect.Parent = workspace KatanaSliceEffect.Orientation = katanaSlash.Orientation KatanaSliceEffect.Anchored = true

I have also tried doing this but it doesnt work and messes up a few things


local KatanaSliceEffect = game.ServerStorage.Effects["KatanaSliceEFFECT"]:Clone() KatanaSliceEffect.Parent = workspace KatanaSliceEffect.CFrame = katanaSlash.CFrame KatanaSliceEffect.Anchored = true

But nothing works. If you have an Idea of what I can do or just tell me what im doing wrong than that would be very much appreciated! Thank you and have a good day.

1 answer

Log in to vote
0
Answered by
udim_2 0
3 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

The last code is somewhat correct

Use CFrame for this problem.

for i = 1, 360 do
    katana.CFrame = slash.CFrame * CFrame.Angles(0, math.rad(i), 0)
    wait()
end
Ad

Answer this question