Hello, I am working on a game for fun and I’ve come across a issue that I am confused about.
So the way I have the game working right now is I have a model called “PlatformLevels” in workspace. This model contains 6 other models inside that are the different levels to the game.
How the system works is that every model has a part called “PlatformDetector”. This detector is a part that when touched will detect what platform level the player is on.
This platform detector has a attribute called “AllowTouch” that is basically a debounce for the touch event so it doesn’t run a million times. By default this is turned off but when the game runs, it is turned on through a server script that loops through each model, finds the detector part, and enables the attribute.
When this detector is touched, a client script will disable the attribute and update the UI above the screen to the current platform that the player is on.
The problem I am having however is that it goes well for the first 3 platforms, but once i get to the 4th one (green platform) it stops working which the only reason why would be that it doesn’t see the attribute as true.
Heres a video to demonstrate it (sorry if its a little choppy)
You can see that it doesn’t update after the 3rd platform and I’m unsure why about it.
^ ^ This here is the system that basically loops through each platform model, finds the detector part, and adds a touch function to it. You can see on line 8 I check if the attribute is true, if it is, everything else after that should run which it does for the first 3 platforms but like I said, on the 4th platform (the green one) it doesn’t run no more which you can see in the video, meaning that it sees it as false even though I checked and it isn’t.
I also tried doing printing and it does show that only the first 3 platforms go through and for the other 3, it says that the attribute is false even though it isn’t.
I have no idea why this is happening as the attributes are true so I don’t understand how it’s seeing it as false. So I’ve come here for an answer.
If you have any questions or need me to clarify on something then please tell me, any help is appreciated