local SoundPlaying = WorkspacePlayer.UpperTorso.IsSoundPlaying
if SoundPlaying.Value == false then
Soundbutton.MouseButton1Click:connect(function()
print("Sound Item Was equipped")
playerSound.SoundId = "rbxassetid://2639636357"
playerSound.Volume = 1
playerAnim.AnimationId = "rbxassetid://2607315975"
playerWait.Value = 6.7649
playerEarnings.Value = 1
end)
elseif SoundPlaying.Value == true then
wait(0.1)
end
In my game, a if statement needs to be constantly checking a BoolValue, since I'm making a inventory and it needs to check if a SoundItem is already equipped. a BoolValue is perfect for this. I know how to make it so when the BoolValue is true, code will run, but when it's false, then another type of code runs, but how do i make the If statement loop, so it can always keep checking?
Please note that the if statement is supposed to run a function, so using a while loop wouldn't work.

5 comments
Your question is too complex without knowing how your "Inventory" works. Please give some explanation and show some code.
Yeah, you need to give us a full in-depth on it, or I can't help as easily xD.
Alright I'll make it a bit simpler.
Try my script.
Is this a GUI, or what?