I was using this code, and now it isn't working anymore. I don't get an error either. Help?
debounce = false
script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats = player:WaitForChild("leaderstats")
local cash = leaderstats:WaitForChild("Cash")
local amount = 5
local weapon = game.ServerStorage:WaitForChild("LinkedSword")
if not debounce then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") and hit.Parent.Humanoid.Health > 0 then
if leaderstats and cash and cash.Value >= amount then
cash.Value = cash.Value - amount
local weaponclone = weapon:Clone()
weaponclone.Parent = player.Backpack
local weaponclone = weapon:Clone()
weaponclone.Parent = player.StarterGear
wait(2)
debounce = false
end
end
end
end)

4 comments
Try turning FilteringEnabled off.
Please help us help you. Tell us what type of script, where it is located, the expected behaviour, the actual behaviour, and whether filtering/streaming are enabled.
You should move that "debounce = false" down to the previous if statement. In the case that something non-player touches it, it'll break forever
A lot of the time when I have a script that was working before but then stops working is cause of the variables not being found, and the output won't print an error, cause you're script will keep looking for it. I would suggest adding prints on every few lines to see where the script stops working