Hello
I recently started scripting a shooter game, and I made a viewmodel as I could by attaching arms to a rifle, but it is really snappy.
This is the server script connected to a Heartbeat:Connect():
script.Parent.rotatearms.OnServerEvent:Connect(function(plr,char,morigin,mhit)
char.Torso["Right Shoulder"].C0 = CFrame.new(1,.5,0) * CFrame.Angles(-math.asin((morigin.p - mhit.p).unit.y),1.55,0)
char.Torso["Left Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((morigin.p -mhit.p).unit.y),-1.55,0)
char.Torso["Neck"].C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.asin((morigin.p - mhit.p).unit.y) + 1.55,3.15,0)
end)
Video:
Obviously I didn’t like the way it looked so I stole the code from this video.
The problem I faced is that this script only works locally, so the other players can’t see which direction the player is facing and from the client the particles (which are server sided) are emitted in the same spot no matter which direction the player is facing.
Server issue:
Particle issue:
I tried making a remote event to fix this but I have issue because the view model is a child of the player camera.