My simple script is not running

Hello! I have a Local Script inside of a model, and the script has;

print("Hello")

Inside of it. No matter what I put in the script, nothing happens. This is happening on Local, Server, and Module scripts. No matter the parent of the script. I was wondering if I could have some help figuring out what is wrong with this. It is only happening on NEW scripts.

1 Like

There is a difference between LocalScript, ModuleScript, and Script.

LocalScripts only run on the Client and can only be ran while parented to certain locations in the explorer.
I recommend checking out the documentation here:

1 Like

Either use a Script with a Client Context, or reparent the LocalScript to a location within StarterPlayer, like StarterPlayerScripts or StarterCharacterScripts.

LocalScripts do not naturally run in places outside of the StarterPlayer. Everything within the StarterPlayer gets cloned when a player joins, and destroyed afterwards. The starter character scripts get cloned every time the player’s character is “spawned” and destroyed on “death.”

Where is the script in the explorer? That will drastically change how everything works.

For local scripts, they only work in these places:

Player Backpack (Inventory/Tools/StarterPack)
Player Character
Player’s Gui (StarterGui. PlayerGui)
PlayerScripts (StarterPlayerScripts, StarterCharacterScripts)
ReplicatedFirst (The first thing to load)

If the model is not in any of these areas, “Hello” will not be printed if it’s a local script.

If it’s a module script, nothing will happen. Module scripts need a local or server script to “activate” them, and they’ll be local/serversided based on what calls them. If you’re a beginner scripter then I advise you to learn the basics first before you learn module scripts.

If it’s a server script, then it should be working everywhere that is a server container (Workspace, ServerScriptService, etc) and if it’s not there, that’s where you should put them anyways. If you really want it to work however outside those places then you can change it’s run context (In properties) from legacy to server to get it to work almost anywhere but that’s not recommended.

1 Like

How are you testing it? In a studio test, in an official dedicated server?

Make it a server script, or, place the local script in starterGui

Also if you were to parent the script to an object not in these places, and that objects network ownership was well, you, wouldnt it also work?

I assume yes cause thats basically how roblox characters are, but dont quote me.