What do you want to achieve? Keep it simple and clear!
I want to make a script that automatically gives players gems for playing the game
What is the issue? Include screenshots / videos if possible!
Every time I run the script it says infinite yield possible.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve read about what an infinite yield is but I still don’t know how to fix it.
local player = game.Players.LocalPlayer
local Gems = player:WaitForChild('leaderstats'):WaitForChild('Gems')
while true do
wait(1)
Gems.Value = Gems.Value + 1
end
local leaderstats = player:WaitForChild('leaderstats')
local Gems = leaderstats:WaitForChild('Gems')
while true do
wait()
Gems.Value = Gems.Value + 1
end