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

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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
0
thank you so much! I just learned from my mistake xenoslav 7 — 6y
0
no problem! Chris75764 49 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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 !!!)

0
Actually the 0.5 wasn't meant there I'd just remove it, but actually it does not work :\ xenoslav 7 — 6y
0
Oh sorry, I'll edit my answer, please accept it if it works then User#20388 0 — 6y
0
Woah thank you! i never thought it would of be just this! xenoslav 7 — 6y
0
np :) User#20388 0 — 6y

Answer this question