wait(10)
while true do
wait(.1)
local equiped = game.Players.LocalPlayer.Equiped
local findknife = false
local debounce = false
for i,v in pairs(game.Players.LocalPlayer:GetChildren()) do
if debounce == false then
if v.ClassName == "StringValue" then
if v.Value == equiped.Value then
findknife = true
debounce = true
else
findknife = false
end
end
end
end
if findknife == false then
game.Players.LocalPlayer.Equiped.Value = "Default"
end
end
I was trying to make a script to prevent players from having something equipped that they don't have in their inventory. However, that didn't work, because it kept setting their weapon back to "default" even if they did have the item in their inventory. My solution to this was to add in the debounce, but now the script does nothing at all. Some help, please?

1 comment
Debounce is only useful when you have a 'wait' command (or anything else that takes time to finish) and when the code might start running multiple times before finishing. As for the rest of your script, I recommend you try 'print'ing out values so that you can see for yourself what's going on. (You might need to change the wait(0.1) to wait(5) while doing this so that you don't get a ton of mess