So I'm trying to make it so when you're level (Leaderstats value) equals to 5, it will play a sound, here is the code}
repeat wait() until game.Players.LocalPlayer.Leaderstats.Level.Value == 5 do script.Level000Congrates:Play() wait(1) end
Please Help.
Hey there! I recommend not using a repeat wait() for this because it will just run uselessly. Instead, you can use GetPropertyChangedSignal.
Here's how :
local player = game.Players.LocalPlayer local leaderstats = player:WaitForChild('Leaderstats') leaderstats.Level:GetPropertyChangedSignal('Value'):Connect(function() if leaderstats.Level.Value == 5 then script['Level000Congrates']:Play() end end)
Make sure this is a local script, and make sure the leaderstats name is 'Leaderstats' (with a capital L)