Scanning problems

I made a script, I need just a little help here, (what did I do wrong)

  script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        if debounce == true then 
            debounce = false 

            local player = game.Players:GetPlayerFromCharacter (hit.Parent)
            local ticket = game.ReplicatedStorage.Ticket:Clone()
            ticket.Player = player.Backpack
        end
    end
end)
 script.Parent.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            if debounce == true then 
                debounce = false 

                local player = game.Players:GetPlayerFromCharacter (hit.Parent)
                local ticket = game.ReplicatedStorage.Ticket:Clone()
                ticket.Player = player.Backpack
                debounce = true
            end
        end
    end)

–You forgot to add debounce = true at the end

Try this:

 script.Parent.Touched:Connect(function(hit)
        if hit.Parent:FindFirstChild("Humanoid") then
            if debounce == true then 
                debounce = false 
                local player = game.Players:GetPlayerFromCharacter (hit.Parent)
                local ticket = game.ReplicatedStorage.Ticket:Clone()
                ticket.Parent = player.Backpack
                 wait(0.5)
                debounce = true
            end
        end
    end)
1 Like