I was trying to make a variable to reach the part “Engine” but for some reason I keep getting the Infinite yield warning. My game doesn’t lag and Engine is a child of Model, Anyone know how to fix it?
Code:
local engine = script.Parent.Parent.Parent:WaitForChild('Engine')
Can you show the contents of the server script that is the local script’s parent? I think I might know what the problem is if my assumptions are right.
Your local script is disabled bro and even then they dont replicate on the workspace. The reason it does not run on the workspace is cause the workspace is the renderer, it processes data on the server. Now I will say your character is treated as a user data so running the local script under the parent of your character data model will work
He’s using an outdated method for replicating the localscript to the client whenever they sit on the vehicleseat. I’d recommend using remotes for that, but in theory this should work.
He’s replicating it in real time whenever the occupant changes. This isn’t a good practice compared to just using remotes.
As for the original post, the problem is that you’re changing the parent of the LocalScript to the Player (or a container where the LocalScript can run), meaning the previous hierarchy of the model is an outdated reference.
Not leaking memory doesn’t mean it’s efficient lol. The practice of “dropping” LocalScript’s into the client pre-dates FilteringEnabled by many, many years. Why rely on old methods when there’s easier ways to do it?