You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am making a Laser Tag FPS game. I have a script that plays an animation when the gun is held out on the server for each player, which works fine. -
What is the issue? Include screenshots / videos if possible!
My problem is that i want the arms to go up and down when the camera moves. it works fine when the gun isnt out until i take it out and it wont work properly while it plays the animation. it moves a little but but it simply wont rotate. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I couldn’t find any solutions online and everything i tried didn’t work either, such as trying different ways to rotate the Motor6D.
Below is the script. Im not very familiar with cframes so most of the code is from online. (anything that isnt defined (player, mouse) is defined, just not in that snippet)
game:GetService("RunService").RenderStepped:Connect(function()
while player.Character == nil do wait() end
mouse.TargetFilter = workspace
player.Character.Head.Neck.C1 = CFrame.new()
player.Character.Head.Neck.C0 = CFrame.new(0, 1.5, 0) * CFrame.Angles(math.asin((mouse.Hit.Position - mouse.Origin.Position).unit.y), 0, 0)
player.Character.LeftUpperArm.LeftShoulder.C1 = CFrame.new()
player.Character.LeftUpperArm.LeftShoulder.C0 = CFrame.new(player.Character.LeftUpperArm.LeftShoulder.C0.Position) * CFrame.Angles(math.asin((mouse.Hit.Position - mouse.Origin.Position).unit.y), 0, 0)
player.Character.RightUpperArm.RightShoulder.C1 = CFrame.new()
player.Character.RightUpperArm.RightShoulder.C0 = CFrame.new(player.Character.RightUpperArm.RightShoulder.C0.Position) * CFrame.Angles(math.asin((mouse.Hit.Position - mouse.Origin.Position).unit.y), 0, 0)
game.ReplicatedStorage:WaitForChild("HeadRot"):FireServer(player.Character.Head.Neck.C0, player.Character.Head.Neck)
end)