Hi, i’ve been rewriting an FPS framework since yesterday, and i found a bug where if i reset, my viewmodel bobbing just breaks.
Here is footage:
I am using Quenty’s spring module from NevermoreEngine.
How can i fix this?
Hi, i’ve been rewriting an FPS framework since yesterday, and i found a bug where if i reset, my viewmodel bobbing just breaks.
Here is footage:
Make sure you have reset on spawn disabled in the properties option for the instance. (Make sure you code defensively to avoid potential errors)
– Edit: Wait this is an entirely different issue, sorry. lol
Can you show code of your work?
I have sent you all my code in private messages.
After reviewing your code I noticed a few things you should probably avoid doing.
Although ReplicatedStorage doesn’t replicate to the server (ReplicatedStorage only replicates to clients in an isolated manner iirc), you should avoid saving things that you can clone to it and instead clone from it every time you require it.
But that is where your issue lies, you are trying to parent a dead object as when you die it probably locks the player and destroys it when you respawn. Try to make it work within player scripts and disable reset on respawn so you don’t get this issue. Which you also set a on death event to destroy the view model.
Also, you are able to post scripts on this forum, it will allow more people to help you as most people wouldn’t want to go through hoops to get the script to point out the problem.
Let me know if that works though.
I want to make a tool based weapon system, how would i fix this bug without rewriting my code to work in a playerscript?
Rewriting code is inevitable. You won’t always get around that, and sometimes it is worth rewriting things as you would know where you can adapt your code to work better for what you want to do. It is also better for efficiency standpoint, so don’t be scared to rewrite things.
Considering you are destroying the view model on death, try disabling that and see if that changes anything. Otherwise just get rid of that line and instead just clone it from ReplicatedStorage every time you spawn.
If the player dies, how would i hide the viewmodel? just set its CFrame to something high like CFrame.new(0, 1e100, 0)
? i just removed the humanoid.died event code, but when i respawn the viewmodel bobbing still breaks.
I am not sure how you set up the entire thing so changing the CFrame to hide it from the screen seems like a bad way to go around it, you could take a look at the enabled property and code something with that and see what you can come up with.
Has the error went away after that change? You may need to rethink the way you approach this outcome. However, I feel you should post your code publicly so more experienced people can help.
I have disabled the Enabled property on death, but the tool acts the same, and it shows on the documentation it only disables the Activated and Deactivated events.
I fixed it! All it took was a single Player.CharacterAdded:Wait().
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.