Why is my plugin script not working?

My script finds if a values are false and if they are it will make another value work but it isint working. Any help?

1 Like

The second while loop will never run. The first while loop will go forever so the code will never even hit the second loop.

Assuming I understand the program correctly I would say that you shouldn’t have any loops in here at all. It would be better to use .Changed or :GetPropertyChangedSignal to handle this. It would make updates instant, as well as remove the need for the loops.

1 Like

I do not understand what you mean by this.

while true do

True will always remain true, because well… true is true

Now since it will always be true then the while loop will never end, because of this you will never hit the second loop. The first loop will always be true and as a result it will never end.

Remember that Lua scripts are read from top to bottom, if the bottom is never reached then the bottom will never execute.

@Spa_rkk You can use a coroutine.wrap to enclose your loop. Since what you send is an image I can’t really send you what I mean, but get the first loop and do this

	while true do
		---... Here put the code inside the first loop

--The second loop goes here

However, I do recomend @tlr22’s idea, doing a loop all the time is very resource intensive and since what you are checking is the properties then you can just check when a property changed

Here I leave an article to better explain this:

now my script to add the config to workspace dosent work

TURNS OUT! The test plugin I was publishing to stoped actualy updating! So… everything I tried to do never happened!

New roblox studio update is breaking the plugin feature!