Weapon local script not running at all

I have a gun fully coded and it doesn’t run at all. It is all managed on a server script. Once a player joins, the gun is added to their backpack via a modulescript required by a script. The gun goes into the player’s backpack perfectly fine but the localscript code will not run. I don’t know how I can fix this. The weapons are being stored in a folder in Server Storage. I tried storing them in Replicated Storage too, but they both give me the same problem. I put print statements to see if it runs at all, and it does not.

1 Like

Local Scripts only work in ReplicatedStorage and is the Local script Parented to the tool?

The local script is parented to the tool. I also tried putting it in replicated storage. (It is in a folder.)

Do you have connect functions in your script? The script runs automatically upon being created and if the script runs before being given to a client, it will error.

Yes, I have connect functions in my script. I tried adding printing statements to see if it runs at all, it does not.

Is the local script working at all?
If not add a print("") in the script, If there is still a problem then We’ve to see your scripts.

Try disabling the script once it is replicated to the player and then reenabling it. If it works after enabling, it is because the script is erroring before it is given to the client. This would also explain why there is no error message appearing.

Update, the print statement showed this time but none of the code in the local script seems to be working properly. I put print statements in the functions, and they are not running. (there is no errors, the functions just dont run)

Can we see your script?

Tried this, and it does not print anything at all after doing that.

What script? The weapon’s code or the code where it is cloned into the player’s backpack?

I have a question is the tool you are cloning in replicated storage or serverstorage?
if you are cloning it from the Server storage then it won’t work.

The weapons code since you are saying it’s not working

I tried cloning it from both and both do not work. Currently I am doing it in serverstorage. The tools are also parented to a folder.

Try putting a print statement at the bottom of your script. If it does not appear, it is because of a function stopping the thread from continuing. This can be fixed by using a coroutine. Being able to see the weapon’s code would be nice.

Is the script Server Script?

The way my weapon system works is that all weapons have a local script inside of them. Each weapon type has its own assigned module instead of having individual scripts for each weapons. They all worked with no errors or problem when they were directly in starterpack. (Upon doing something like firing, it triggers a remote event handled by the module)

Is the Module in ReplicatedStorage or inside of the Tool?
and I would like to see your code there might be something wrong with it.

Every weapon’s module is in serverscriptservice. The server sided code has nothing to do with this. It is the local script which is not running.

I put print statements all over the code and found that it does not get past the variables.

ServerScriptService can’t communicate with Local scripts you have to use a RemoteEvent if so.