This may sound nooby and whatnot, but I was making a badge giver in my game that awards you a badge when the team you're on has a certain amount of Moral. I was going to make it look something like this:
while true do
wait(.1)
Player = game.Players:GetPlayerFromCharacter(script.Parent)
Badge = game:GetService("BadgeService")
if Player.Team == game.Teams.Prussians then
if game.Teams.Prussians.Moral.Value >= 50 then
Badge:AwardBadge(Player.UserId, 11223344)
end
end
end
This is fine, but I have quite a few other scripts that also loop quickly to find something, and I feel like a lot of loops could slow down my game (as the title implies) I could instead use a .Changed event on the value instead, though this would mean new players wouldn't get the badge until the value changes again.

4 comments
it can depending on what they do
Ah, so would something like what's above be laggy? I don't think I'll be using it because I decided the .Changed version is better for new players anyway, but if I did would it cause any lag?
its pretty small so it probably wouldnt lag, but something like 10 times bigger than this or whatever will probably lag
if you put while true do wait() print('hello') end - it will lag a lot. because its being printed every millisecond, if loops that change local variables arent that much of a lag.