Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does kill/ break script kept popping up?

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

1 comment

2 answers

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.

3 comments

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.

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?

0

i don't know. but i do know that tag methods were removed and replaced with metatables

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

1 comment

0

LMAO you got no idea what I'm talking about

This discussion is preserved as it was. New answers, comments, and votes are closed.