Gets values inconsistently

I have been making a system where if a value inside the player is set to true you will be given a ladder skin, however it’s been extremely inconsistent and fails to give the skin.

I have been trying to fix this for the past day and it’s very frustrating. The values are set to true yet when it goes to check the value it skips right past it.

Every now and then it works, but 90% of the time it doesn’t.

Screenshot_9
Screenshot_10

This is how I am checking the value:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if player:WaitForChild("unlockedLadders").SILVER_LADDER.Value == true then
			print("got SL value")
			createLadder("Silver", player)
			print("created silver ladder")
		else
			print("user doesnt have silver ladder")
		end
	end)
end)

Any ideas?

It could be a race condition. The code might run before the value is set.

1 Like

You’re right, I’m not sure why I didn’t try checking that earlier.
All fixed now, thank you for your help! :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.