Hello everyone! So i am making a mini gun turret for my new game that aims/looks at the player’s mouse and I’ve decided to have the barrel spinning (Barrel will spin when you shoot with the turret) done on the client instead of the server to reduce some lag. And i have run into a snag…
So since I am doing the spinning on the client, i have to hide the barrel on the server side (Hiding it for the client using the turret so there aren’t 2 barrels inside each other) and clone the barrel on the client side to be able to actually spin it. Because of this, i have to set the position and angle of the barrel to match the server sided one, and be able to spin at the same time, which turns out to be quite a painstaking task to do/figure out. Here is what i have tried to do already:
spinner:SetPrimaryPartCFrame(prevgun.GunHori.GunVert.Spin:GetPrimaryPartCFrame())
spinner:SetPrimaryPartCFrame(spinner:GetPrimaryPartCFrame() * CFrame.Angles(math.rad(rot), 0, 0))
prevgun = the barrel on the server side
spinner = the barrel on the client side
So on the first line, I set the barrel on the client side to match the barrel on the server side. On the second, It would theoretically actually do the spinning. But what ends up happening is the client sided barrel matches with the server sided barrel, but does not spin. So my issue/question is, how would i be able to keep the position and the angle of the server sided barrel, but also be able to continually rotate and spin it? I should also note i have never done succeeded from doing something this advanced with the CFrames. Any help will be greatly appriciated! ![]()
Edit: Let me know if you need more details, I’ve tried to include as much detail as i could.