LocalScripts not executing if in the workspace?

Hi.

Recently been mucking about with some scripting for players that join my game; I’ve found that if a LocalScript is placed in the workspace, it won’t execute at all.

I’ve checked with a couple of my friends who are experiencing the same thing.

Unsure whether this is a bug that should be reported?

Any input’s appreciated, thanks.

1 Like

LocalScripts themselves cant run within the workspace

Its not a bug, but intended, if you read what a LocalScript can do, it will tell you specifically what it works for.

If you want it in the workspace, to put it simply: You Cant.

However roblox added a feature using a Server Script where set its RunContext to Client, this will turn it into a LocalScript, but can run in the workspace

3 Likes

That’s interesting.

AFAIK, they always used to execute in the workspace without problem. Is this a new feature?

I appreciate the workaround either way - thanks!

It’s fairly recent. Probably at least under a year old, could be wrong.

They never did, maybe you’re having a mandella effect? I definitely remember it being annoying which is why the new feature existing is really useful.

A bit of a nitpick but I wouldn’t call this a workaround but an intentional feature to combat this problem.

Mainly, as I had mentioned earlier, LocalScripts don’t execute in the workspace as they only execute if parented to a tool parented to a character or the player’s backpack; or parented to the character or the player’s scripts or under a GUI parented to player’s gui container instance (PlayerGui).

After many years of this feature being annoying, they finally decided to add a solution. Instead of adding a property to LocalScripts and server Scripts, they put them all into one.

Here are the three different RunContexts and how they work:

  • Legacy - Server script will work anywhere but (I think) ServerStorage
  • Server - Server script will work anywhere
  • Client - Client/local script will work anywhere
  • Plugin (FUTURE) - Doesn’t exist yet, but in the future will be used for plugins. Exists in the enum Enum.RunContext but can’t be used/selected
  • Not a run context but LocalScripts - Similar to Legacy, but client. Client/local script will run only in tools under characters/backpacks or the script itself will work under character/player scripts/gui.

Hope this little bit of history and trivia gave you a better understanding!

1 Like

What?

In the first paragraph, replying to the first quote of OP

As in this ^^^^^

Edit: sorry if that was confusing :sweat_smile:

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