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

Does (if game.Players.LocalPlayer.leaderstats.x=="someting" then something) works?

I kept wondering how could I make a while read

while wait(0.5) do if game.Players.LocalPlayer.leaderstats.Points.Value=="2000" then script.Parent.Text = "Good job!" end end

the script being in a Gui's Label.

If anyone has an answer to this, I will give all my love <3

Thank you for taking the time to answer :)

2 answers

✓ Accepted answer

It works, but i made a different version of the script.

while true do
wait(0.5) 
if game.Players.LocalPlayer.leaderstats.Points.Value == 2000 then 
local Playername = game.Players.LocalPlayer.Name
script.Parent.Text = "Good job, " .. Playername
end 
end

2 comments

0

thank you so much! I just learned from my mistake

0

no problem!

It would probably work yeah, that doesn't mean that it would work reversed (setting a value in a local script isn't a good idea)

The while loop is okay but do you really need it to test a value ever 0.5 second?

EDIT: This won't work as 'Points' is a int/number value but what you wrote is a string value, to fix it simply change "2000" to 2000 ("' makes everything between a string)

(Also use :WaitForChild !!!)

4 comments

0

Actually the 0.5 wasn't meant there I'd just remove it, but actually it does not work :\

0

Oh sorry, I'll edit my answer, please accept it if it works then

0

Woah thank you! i never thought it would of be just this!

0

np :)

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