Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Workaround local scripts in the wokspace?

Having troubles with getting things local when they need to

I have a script with an array and a remote function to get that array. Thing is, like all remote function it has a delay. What I thought I could do is have a local script on same object that would sync array variable with server when it's changed, so player can get it instantaneously when needed.

LocalScript can only work in some certain places, not workspace though. What would be the best way to workaround this? Another idea I had is keep a local script in player scripts and track all objects that have array but that sounds messy

Thoughts?

2 answers

Well, not all LocalScripts in the Workspace refuse to run.

A LocalScript will run in the Workspace under the condition that it is parented to a Model that is associated with an active client. In simpler words, LocalScripts that are located in Characters of Players in the Workspace will run, but any other LocalScripts will not. In order for a LocalScript to be functional it must have a client associated with it.

Your best bet to get the script into the Workspace is by putting it in StarterCharacterScripts. This service clones any script that is a descendant of the service and assigns the clone to any Character that joins the Workspace. Otherwise, you'd have to put it somewhere else where a LocalScript is able to run.

1 comment

0

+1 for complete answer

Couldn't you put the LocalScript either in StarterGui, StarterPlayerScritps or StarterCharacterScripts?

2 comments

0

Sorry, miss-spelt StarterPlayerScripts.

0

-1 for asking a question as an answer. If it fits in a comment, it belongs as a comment.

This discussion is preserved as it was. New answers, comments, and votes are closed.