I made a script that determines a player distance to a brick and then I added a debounce to it but it didn't work.How could I fix it so it can work and so it won't spam it on the players Gui? Please show how you managed to fix it.
while true do wait(0.1) for Number,Player in pairs (game.Players:GetChildren())do--Gets all the Players in the PlayerFolder ---------------------Vairibles--------------------------- Part = script.Parent Guis = script.Guis ---------------------------------------------------------- Near = false -- Near is a debounce set to false Distance = (Player.Character.Torso.Position - Part.Position).magnitude --Gets the Characters Torso's postion and the postion of the part if Distance < 6 and Near == false--If the distance is lower the 6 then it will do the thing below then Near = true for Num,AllGuis in pairs (Guis:GetChildren()) do--Gets the guis from the folder ClonedGuis = AllGuis:Clone()--Clones the Guis ClonedGuis.Parent = Player.PlayerGui -- After the guis are cloned then their put inside the Player's GUI folder end Near = false end end end