Script can't locate object even though it's there

oh nevermind it’s not fixed. I thought for sure it was. Now I’m extra confused because I just went to one of my old games to double check, and turns out a bool value can go in starter pack and a script should be able to locate it. I used the exact same method, but for some reason it doesn’t work.

Send the full script and a screenshot of the explorer of the starter pack, if your on windows than you can use sniping tool(search in start menu) then you can just press snip to take a screen shot of a partial area on your screen then just ctrl v in dev fourm.

Sure. While editing:

And in the game:

image

image

Idk why but try to remove the .Value and see if it prints anything or if the warning still persists.

Removing the .Value won’t do anything because it happens after the WaitForChild.

print backpack.Playing before you do the wait for child, i am desperate at this point, does the print nil or the name, then somethings odd.

Oh wait… it printed out Backpack in the output but when I clicked on it nothing happened. I think what happened is that it located the Backpack, then for some reason the backpack reloaded into a new one.

This is why I hate working with character models and player objects, stuff is always reloading

What you should do is put the script in starter character script, then wait for the backpack in that script so that its for each new character because i think it resets.

Could it be print(backpack:WaitForChild("Playing").Value.Value) since most times if you reference a Value that’s the name of item, but if you put Value.Value you are reading the actual Property.

No I don’t think scripting works like that.

I’ve decided to use an entirely new method for my music. I just put a giant invisible part around the lobby and if your character is inside it then it will play the lobby music.

I just don’t wanna use this anymore because it seems complicated and inefficient.

Have you trying “detecting” the amount you have to wait, simply by doing:

local start = os.time() 
local Playing = backpack:WaitForChild("Playing", math.huge)
print(os.time()-start) --seconds after it loads. 

Wait, if you are trying to find a Player’s backpack item you should be looking in their Character backpack in the Workspace.

No, things only go to the character if the player holds it, and this is only applicable to tools.

Yes, but as I understand it Players is the container that holds the information about each Player that is loaded into that container, but the Character is the actual Player’s avatar that is moving around the Workspace and has been Spawned from the Players container.

If you refer to Players you aren’t going to change the Value for the Avatar currently in the Workspace.

It’s a BoolValue instance which is cloned into the player’s backpack each time their character spawns/reloads.

1 Like

I’d recommend just placing the BoolValue instance in a more suitable location like the ReplicatedStorage folder.

I’m having the same problem detecting a boolvalue from a character, It doesn’t detect it after the player died and respawned. has anyone fixed this?

Sounds like you’re assigning the boolvalue to the player in the workspace (not in the Player service) and referencing it in the script, but when the player dies that reference in the script isn’t being switched to the new player in the workspace.

I searched “script doesn’t work after player dies” and got quite a few hits like this one: Script doesn't work when player dies

1 Like

Hello, thanks for the responses. That was indeed the problem I had and have solved it earlier. Thank you!

1 Like