I’m not aware of any intended feature that framecaps scripts like that. Have you tried verifying that it’s running every frame?
How would I do so? (30 characters)
A quick and dirty method might be to have another script parented somewhere in which it works printing every frame, and have a print in your original script.
If they are both running every frame it should print from each of them in turn, i.e.:
print1
print2
print1
print2
I did one in the script which fires the viewmodel function and one in the camera script (which is parented directly to the character) and I can confirm. They both fire every frame.
The values in the prints is time()
.
Weapon RenderStep 9.3875004933216
Camera RenderStep 9.3875004933216
Weapon RenderStep 9.4083338272758
Camera RenderStep 9.4083338272758
Weapon RenderStep 9.4250004948117
Camera RenderStep 9.4250004948117
Then we can rule out a frame-skip.
Are you 100% sure that the script is running after the camera is updated? Are you using the default roblox camera or a custom one?
Before you say anything… in my defense I made this camera script a year ago and hadn’t heard of RunService:BindToRenderStep()
back then.
After I read what you said, I went straight to my camera script and switched out:
RunService.RenderStepped(function(deltaTime)
with:
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, function(deltaTime)
which stupidly enough, fixed it.
There we go!
99% of the time it’s just a simple mistake in your own code, always be suspicious when you find a weird bug like that.
Glad to be of help
I suppose the reason for why the parent mattered for it to update smoothly was due to it being by luck bound to render step just about in the right order after the camera to update after the camera did because the script parented to the character was replicated a lot faster than the script in the weapon itself.
RenderStepped is such code smell tbh. Constantly leads to issues like these, but it can happen to anyone lol. Ideally you should always know what order your code is running in.
I only ever use it for :Wait(); binding to it is too dangerous…