function detectWinner()
local players = game.Players:GetPlayers()
for i=1, #players do
if players[i].Settings.Winner.Value == true then
print ("it is true!")
players[i].leaderstats.Coins.Value = players[i].leaderstats.Coins.Value + 10
wait(0.01)
end
end
while true do
wait(0.01)
detectWinner()
end
end
I'm detecting (trying to) if the winner's value located inside the player. I want it to be a loop so that it is always trying to detect if there is a winner. If there is a winner, I want to add 10 coins to the player's stats. When I test the game and go into the player's settings folder (created in a separate script), and check the winner value to change it to true, there is no change in coins. In the output it also doesn't print "it is true" meaning that the upper part of the script isn't working. I think it is the way I located players, but I'm not sure. I'm not good at locating player properties since I'm kind of a beginner scripter. Can someone help?

2 comments
You should use a i,v in pairs() loop.
Try using the changed event. http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed