Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Localscript won't start to run for no reason?

Asked by
blowup999 659 Moderation Voter
8 years ago

I have a local script with a stringvalue and 2 boolvalues inside of it. The localscript is inside a model that is inside replicated storage. Eventually a textbutton causes the model to be put inside workspace.CurrentCamera.

Disabled is set to false and filteringenabled is also set to false

The very first line of the localscript is

print("Starting")

It doesn't show print("Starting") anywhere in the developer console, and it doesn't give any errors. None of the other lines of code after it run either.

0
show us more code so we can help find the problem iamnoamesa 674 — 8y

2 answers

Log in to vote
1
Answered by 8 years ago

Hello, blowup999

The problem is the parent. LocalScripts does not run inside workspace.CurrentCamera so maybe you should replicate it somewhere else.

~Radio

If this helped you, accept and upvote, it helps both of us :)

Ad
Log in to vote
0
Answered by 8 years ago

Your problem may be that localScripts only run inside specific places in the game.

From the wiki:

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

A Player's Backpack, such as a child of a Tool

A Player's Character model

A Player's PlayerGui

A Player's PlayerScripts

The ReplicatedFirst service

Note: the parent of the LocalScript will determine which client the Lua code will be executed on.

Try putting the script into the player's scripts or ReplicatedFirst, and it should work

Answer this question