Creating a rocket launcher. Simple enough. I clone the rocket and it moves.
It works on the first shot, then doesn’t on the second shot because something doesn’t exist. The thing that doesn’t exist in question is the explosion itself.
Error:
09:08:37.661 Explosion is not a valid member of ModuleScript "ReplicatedStorage.Services.Rocket" - Client - Rocket:43
09:08:37.661 Stack Begin - Studio
09:08:37.661 Script 'ReplicatedStorage.Services.Rocket', Line 43 - function Explode - Studio - Rocket:43
09:08:37.661 Script 'ReplicatedStorage.Services.Rocket', Line 105 - function Shoot - Studio - Rocket:105
09:08:37.661 Script 'Players.SkrubDaNub.PlayerScripts.Client', Line 53 - Studio - Client:53
09:08:37.661 Stack End - Studio
Lines that errored:
local explosion = script.Explosion:Clone() -- SPECIFICALLY HERE
explosion.Position = position
explosion.Parent = workspace
debris:AddItem(explosion, 1)
debris:AddItem(rocket, 1) -- allow for time for lag compensation
This errored on a local script (I want the visual part of the rocket to look like it fired the moment you clicked, then the server handle hitregistration and stuff in the background).
Let me make it absolutely clear: it worked on the first shot.