I create a money system. It's called "Outfit", it's located in game.Players.LocalPlayers. And the value for it is called cash. And the script below is what happens next however when I enter test mode an error showed up about the script been running for too long. And I got no idea how to solve this problem!! I tried but never succeed it's kept on popping up and now all my scripts are effected. I used the wait() but it never solve the problem.
1 | while true do |
2 | wait() |
3 | if game.Players.LocalPlayer:findFirstChild( "Outfit" ) then |
4 | wait() |
5 | script.Parent.Text = "$" ..game.Players.LocalPlayer.Outfit.cash.Value |
6 | end |
7 | wait() |
8 | end |
I don't really know how to solve this problem, but you could Instead of using the wait() function inside the loop, you could do this instead:
1 | while wait() do |
2 | if game.Players.LocalPlayer:findFirstChild( "Outfit" ) then |
3 | script.Parent.Text = "$" ..game.Players.LocalPlayer.Outfit.cash.Value |
4 | end |
5 | end |
Also, make sure the script is a LocalScript and is running inside the player or player's character.
It's Because it keeps Finding The "OutFit" and Doing it again and again.