Folder that load but not every time causing game to break

So basically I have a folder that load when joining a player join or die. The problem is sometimes it will load and sometimes it won’t load causing the leader stats not loading and thus making my game unplayable. And I couldn’t figure it out.

Screenshot_37

Thanks for reading!

What is the script giving the player that folder or value called “CurrentTool”?

Anyways, you could try doing

Plr:WaitForChild("CurrentTool", X)

X means the time the script will wait before continuing, so until it does not find that Child, it will not continue. However, this is not really suggested, it is better to wait until the script creates that Child with wait().

No, it will create a folder that will have the last used tool by the player

I will try that method and reply with whatever result I get. Thanks!

So in that case, the folder is called “CurrentTool”? If so, you have the same answer as my last post.
If not, you just found the error (you have to put the Folder name and then the CurrentTool value).

Actually, it’s the opposite. They both accomplish the same result, but WaitForChild causes less lag.

1 Like

I don’t know for some reason it did not work.

Just to note the folder is created in the leader stats script

Can you please send a screenshot of the player properties inside the Game Explorer when running the game?

I manage to find something weird with creating the folder in the player.

Screenshot_39

The current tool script was in the bottom of the script when I moved it up the ownedArea script wasn’t being created

and I just realised and forgot that it’s string value. :man_facepalming

So, is it fixed? If not, let us now.

Unfortunately no

Screenshot_40

Can you send the whole script you sent in the last post? Do you have any wait()?

I think I fixed it.

I had a line saying:
local char = player.CharacterAdded:Wait()

when I removed it has fixed it for some od reason.

I managed to fix it’s because of this one line that was unnecessary in the leader stats script. But thanks anyway!

Use

locar char = player.CharacterAdded

instead, it may help you.

1 Like