I have this “Arm” Part which displays weapons. I want to know how to rotate it.
I know how to rotate it by changing its Orientation but since I have weapon models welded to it, for some reason only the arm rotates and the objects welded just stay in place. Please show me how to rotate the arm in a way that it will make the welded objects follow.
In studio, you have to select both the arm and the weapon but in game you can rotate it and the weapon will stay welded if it is not anchored.
how do i rotate the weapon when its unanchored like it will fall if i unanchor it
Make the arm anchored but the weapon unanchored
1 Like
Also, what exactly are you trying to do? Change this in studio or in game?
in game like i want to be able to rotate the arm in the shop
Oh well, if you want to rotate the part in game, just make sure the arm(the part you are changing) is anchored and that the weapon is unanchored.
1 Like
Make sure you are changing the part’s CFrame when using TweenService on welded parts.
it doesn’t work. This is how i rotate it
arm.Orientation = Vector3.new(90, -90, 0)
arm.Anchored = true
local rotationamount = 5 – how much the arm rotates by
local function rotate(increment)
local add = Vector3.new(0, increment, 0)
local weapon = folder:FindFirstChild(plr.Name) – The weapon model in the shop
weapon.Anchored = false
for _, part in pairs(weapon:GetDescendants()) do
if part:IsA('Part') then
part.Anchored = false
end
end
arm.Orientation += add
print('Rotating by ' ..increment)
end
I use orientation += vector3 is there an easier way to rotate it if thhat will solve it?
local uis = game:GetService('UserInputService')
local plr = game.Players.LocalPlayer
local folder = workspace:WaitForChild('ClassesBuilding')
local arm = folder:WaitForChild('TPPart')
arm.Orientation = Vector3.new(90, -90, 0)
arm.Anchored = true
local rotationamount = 5 -- how much the arm rotates by
local function rotate(increment)
local add = Vector3.new(0, increment, 0)
local weapon = folder:FindFirstChild(plr.Name) -- The weapon model in the shop
weapon.Anchored = false
for _, part in pairs(weapon:GetDescendants()) do
if part:IsA('Part') then
part.Anchored = false
end
end
arm.Orientation += add
print('Rotating by ' ..increment)
end
uis.InputBegan:Connect(function(input, gpe) -- rotate left
if not gpe then
if input.KeyCode == Enum.KeyCode.Q then
while uis:IsKeyDown(Enum.KeyCode.Q) do
rotate(rotationamount)
task.wait()
end
end
end
end)
uis.InputBegan:Connect(function(input, gpe) -- rotate right
if not gpe then
if input.KeyCode == Enum.KeyCode.E then
while uis:IsKeyDown(Enum.KeyCode.E) do
rotate(-rotationamount)
task.wait()
end
end
end
end)
This is the whole code. I have pre welded the weapon to the arm in a different script
What happens? Does the arm move?
only the arm moves. the weapon stays in place
Well then maybe the weapons has meshparts or other models, you can either add deeper recognition to unanchor all parts or just unachor the weapon in studio
they are all parts and I used a plugin to weld them. The weld to the arm is scripted when you play
The weapon is placed into the classes folder as (plr.Name)?
its placed in the building folder which I named Classes Folder. Its called (plr.name) because it is so that I can easily delete it for individual clients.
Could you run the script and let me know which parts are not anchored?
1 Like
if you mean run the game I did it. The Arm was anchored and ALL the gun parts were unanchored. I can send a clip of what keeps happening
I am Pressing the keybinds which rotate the arm. This is all that happens
1 Like
Is the weapon welded to the stand? Make sure its not