Cloning doesn't... clone?

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.

2 Likes

Update: I fixed this by replacing it with an Instance.new(). Still, why can’t I clone it?
It also appears to delete itself upon running.

If script.Explosion is instantiated while the game is running, it will delete itself.

1 Like

…because of course it does. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.