So I have been making this Dead Space Plasma Cutter type thingy and I ran into this issue where I have been trying to rotate the blades of the gun on one axis while all the other axis' aren't affected (or actually rotate). I don't know how to make this work so any and all help will be largely appreciated.
All code and sources are below to get an easier understanding of what I'm trying to accomplish.
For quick clarity I'm using a mesh part, Blades, that welds every part that's supposed to rotate upon pressing the space key. And that mesh part is motor6D welded to the Handle mesh part.
The hierarchy: https://gyazo.com/0f3c23304baddf2b0dcac5a90d471f82
https://gyazo.com/79abfd4ac96598ea10d1d95a36a66524
Code I have been using to rotate the 'Blades':
local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")
local plasmaCutter = script.Parent
local handle = plasmaCutter:WaitForChild("Handle")
local blades = plasmaCutter.Blades.Blades
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.Space then
local currentRot = blades.Orientation
local targetRot = Vector3.new(currentRot.X, currentRot.Y, currentRot.Z - 90)
TS:Create(blades, TweenInfo.new(0.1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {Orientation = targetRot}):Play()
print("Alt fire!")
end
end)
What it should look like (while being able to move ofc): https://gyazo.com/55d733a945b9ed5afe6737f46709162a
The problem: https://gyazo.com/1b92741704ff49ee36d496feb53da891
