I'm making this script in a sword, and it's supposed to kill the enemy when you click on it with the sword equipped.
The script:
script.Parent.Activated:Connect(function()
local Mouse = game.Players.LocalPlayer:GetMouse()
local Target = Mouse.Target
if Target == game.Workspace.Health then
game.Workspace.Health.Humanoid.Health = game.Workspace.Health.Humanoid.Health - 10
end
end)
In the output, it gives me this error message:
17:45:49.016 Players.charizardstar87.Backpack.ClassicSword.Script:2: attempt to index nil with 'GetMouse'

1 comment
Oh, you're right, lol thanks