Script not detecting folder in Workspace

Here’s the script that I am using to disable a script within that folder, I’ve tried Models but the same problem happens.

workspace.Music.Installer.Disabled = true
	workspace.Music.Installer.LocalScript.Disabled = true

For more context, it’s a mute button for a custom made music player.
In theory, on LMB it should disable the script, stopping the music from playing, however, it says

16:26:28.375 - Music is not a valid member of Workspace

I have no idea why this is happening, please help!

(I’m using this in a Script instead of a LocalScript, as I tried a LocalScript and the script didn’t even work)

It’s most likely being removed by somthing, or its unachored I had the same problem with a script of mine.

1 Like

I don’t think there’s any way that I can anchor a folder from my knowledge, anchoring only applies to parts and models in workspace with parts inside of them.

Oh i miss read, I saw model and assumed. Sorry…

However it is most likely it is being removed or the path to the object is incorrect.

Can you screenshot the folder in workspace?

1 Like

Is the Music folder being put into Workspace by another script? If so, I recommend doing workspace:WaitForChild("Music") so that the script will not advance without the Music folder being there.

2 Likes

WaitForChild is a life saver…

1 Like

I already have the folder in workspace already, I didn’t make it insert with a script.

here it is with a screenshot.

image

Ok so

Workspace:FindFirstChild(“Music“)
Game.workspace;WaitFroChild(“Music”)

Should be the path or add game in front of it.

I feel it is most likely that you spelled somthing wrong or its being removed.

1 Like

Sometimes the script loads faster than objects load into the game.

Using WaitForChild halts the script until this object is loaded into the game.

2 Likes

I didn’t misspell anything within the script, I used,

workspace.Music

i have even referenced other items in workspace like separate scripts and it has detected them and disabled them.

It is possible the script is looking for a property in Workspace instead of a child. You can use game.Workspace:WaitForChild("Music") to always wait for the child. Sometimes the script will load quicker than the objects therefore using WaitForChild() will stop the script from advancing until that object is loaded into the game.

use wait for child. So it loads

With that you can also set the wait time

Example

game.Workspace:WaitForChild(“Music”, 60) — would wait for 60 seconds

However, how do I go ahead and select the items that are in the folder?

GetChildren() is to get items in folder

Game.Workspace:WaitForChild(“Music”, 60):GetChildren()

Pretty sure thats legal correct me if I’m wrong…

Let me test my script again not in studio, and see if it works there.

Also, is FireClient() legal? I just set my Client on fire!

Does this happen once the player clicks a button? If that is the case WaitForChild is useless as it would have already loaded with the players character.

I would recommend using FindFirstChild()

1 Like

:FireClient() is used when handling RemoteEvents and will fire an event to one specific client. This can be useful for doing things such as making GUIs pop up, etc.

2 Likes

Yes, it happens once the player clicks a TextButton.

FireAllClients fires all clients. FireClient fires one. you can look at an alvin blox video or dm on discord for my info about it

Cliffon#2633

My dms are open if you need any help.

1 Like

I was making a joke about it lol, you know :FireClient() Fire Client,
meh it’s no longer funny when i had to explain it