I'm trying to make a gun right now. When ever i click it just leaves me with this error: attempt to index nil with 'Target'"
local db = false --debounce
script.Parent.Equipped:Connect(function() --when its equipped
local player = game.Players:FindFirstChild( script.Parent.Parent.Name) --player
local character = player.Character --players character
local Handle = script.Parent.Handle --the tools handle
local Fire = script.Parent.Particles.FirePart.Fire --the particle for when you fire the gun
script.Parent.Activated:Connect(function() --when clicked
if db == false then --debounce
db = true
local mouse = player:GetMouse()
print(mouse.Target.Name) --error
--still writing some code here
wait(1)
db = false --setting the debounce back to false after 1 second
end
end)
end)

5 comments
Is it a server script?
You didn't ever define mouse.
He did, are you blind?
i define the mouse right before the error and yeah its in a server script
anyone know how to fix it