while true do
local player = game.Players.LocalPlayer
script.Parent.Text = player.ds:FindFirstChild("Cash").Value
end
What is wrong with this script?
while true do
local player = game.Players.LocalPlayer
script.Parent.Text = player.ds:FindFirstChild("Cash").Value
end
What is wrong with this script?
Problem:
Your most important function you are missing in your loop, is a wait function.
Why a Wait?
The reason why you need a Wait is because, a While loop with continue infinitely when executed, Without a wait, the Loop runs continuously, and crashes the client.
local player = game.Players.LocalPlayer
while wait() do
script.Parent.Text = player.ds:FindFirstChild("Cash").Value
end
Additional Credits :
Validark
There seems to be a problem with line 4
Nevermind, it worked as I resetted the character! Thanks all of you.
local player = game.Players.LocalPlayer
while true do
script.Parent.Text = player.ds:FindFirstChild("Cash").Value
wait() -- you made this an infinitive loop with no wait.
end
Please put player variable outside of the loop.
trying to keep it as similar to his as i can but okay
while wait() do
local plr = script.Parent.Parent.Parent.Parent
script.Parent.Text = player.ds:FindFirstChild("Cash").Value
end
Now you don't need a LocalScript, use a regular script.
If you see my reputation has gone down, two people downed it because of their misunderstanding...
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
There are two problems: 1. You did not add a 'wait' to yield the 'while' loop to prevent it from firing the chunk infinitely on Execution, thus crashing the client. :P 2. Why is the Variable 'player' inside the 'while' loop? Why not put it outside of the loop? :)