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

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

Asked by 8 years ago
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.

0
Is this script running in a local script inside the player? joshuatodd21 40 — 8y
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. ScriptGuider 5640 — 8y
0
well okay bossay8 8 — 8y
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 ScriptGuider 5640 — 8y
View all comments (3 more)
0
Thanks but can you help me with the sctual question bossay8 8 — 8y
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. Link150 1355 — 8y

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
8 years ago

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.

0
Thank you bossay8 8 — 8y
Ad

Answer this question