Thruster can't be created

Why am I getting this error?

“Thuster can’t be created”

Script:

function ShoppingCartScript:Init()
    self.thruster = self:GetEntity():CreateThruster()
end

Script is applied to a Mesh Entity, with physicsEnabled=true.

What could be the reason for this error?

I figured this out myself: When you have an entity with a script that creates a thruster in the Init event, and you repeatedly test your script by activating and deactivating the ‘simulate’ option on the entity, then after a while you get this error.

I’m guessing that when deactivating the simulate option, the created thrusters aren’t removed from the entity, and each time the simulation option is activated, the Init funcion is called and new thruster is created. After a while, a maximum number of thrusters is reached.

So, is this a bug or a feature?
In what script event/function should once place the code to remove the thrusters, so that this code is called when the simute option is deactivated?

1 Like

I’m not using simulate option and I still start to get that after some time (I’m using preview mode instead).

Once it starts to hit, I can’t work with thrusters anymore until some other time (was not able to determine how long’s that exactly, but usually next day it’s fine).

I added code like this

function MyScript:OnDestroy()
	self:GetEntity():DestroyThruster(self.myThruster)
end

in hopes that it would allow me to avoid this problem, I’d see how it goes from here, but honestly that looks like a bug on a Crayta side, I don’t understand why it cannot clean them itself.

After I made that workaround, I don’t have the previous problem, when thrusters would just stop creating forever, but now I noticed that right after “Thruster can’t be created” during preview, when I go back from preview the whole server crashes (start countdown till 60 seconds and restarts).