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

Why does this script only work in studio and not in the actual game?

while true do
	wait(.00001)
	script.Parent.Text = game.Players.LocalPlayer.leaderstats.Money.Value
	end

So, the problem here is that this script works fine in Studio. But when i test it in-game it stops working. I don't know what to do, please answer.

7 comments

0

Is this script running in a local script inside the player?

0

Just a side note, the smallest interval you'll get out of "wait" is usually only close to 1/30th of a second, which is the set amount of time the thread will remain in the scheduler queue (See thread scheduler: http://wiki.roblox.com/index.php?title=Thread_scheduler). In other words, "wait()", "wait(0.01)", "wait(.00001)", or anything under 0.03, will just default to the lowest possible interval.

0

well okay

0

Conclusion: Just use "wait()", with no arguments. If you want something faster, you can check out RunService and it's events here: http://wiki.roblox.com/index.php?title=API:Class/RunService

0

Thanks but can you help me with the sctual question

0

Bossay, you can't use LocalPlayer from a regular Script. Besides, it doesn't make sense to manage a GUI with a regular Script.

1 answer

✓ Accepted answer

Use a localscript. Scripts can not acces game.Players.LocalPlayer

Anything inside the client should use a LocalScript, anything not in the client should use a Script.

1 comment

0

Thank you

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