Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does kill/ break script kept popping up?

Asked by 7 years ago

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.


while true do wait() if game.Players.LocalPlayer:findFirstChild("Outfit") then wait() script.Parent.Text = "$"..game.Players.LocalPlayer.Outfit.cash.Value end wait() end

2 answers

Log in to vote
0
Answered by
Bisoph 5
7 years ago

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:

while wait() do
    if game.Players.LocalPlayer:findFirstChild("Outfit") then
    script.Parent.Text = "$"..game.Players.LocalPlayer.Outfit.cash.Value
    end
end

Also, make sure the script is a LocalScript and is running inside the player or player's character.

0
P.S. Scripts can only use game.Players.LocalPlayer if it is running in a LocalScript; if it is running in a Script, it will return nil. Bisoph 5 — 7y
0
Can you enlighten me because I haven't been on Roblox for a while. And I seen a lot of changes in the studio. Do you have any information for something I need to know about in the new Roblox LUA? FunimationStudioArt -14 — 7y
0
i don't know. but i do know that tag methods were removed and replaced with metatables Bisoph 5 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

It's Because it keeps Finding The "OutFit" and Doing it again and again.

0
LMAO you got no idea what I'm talking about FunimationStudioArt -14 — 7y

Answer this question