I'm trying to make a hitscan gun when I finished and click someone they won't die I made a local script, normal script, and a remote event. The remote event is in the tools and I'm getting a error saying > This Mouse is no longer active
LocalScript
local MaxAmmo = 5
local Ammo = 10
local Ammo1 = MaxAmmo
reloading = false
script.Parent.Equipped:Connect(function(mouse)
local function reload()
reloading = true
--insert animation script here
wait(5)
Ammo1 = MaxAmmo
Ammo=Ammo-5
reloading = false
end
local function reload1()
reloading = true
reloading = true
--insert animation script here
wait(5)
Ammo1 = MaxAmmo
Ammo=Ammo-Ammo1+1
reloading = false
end
mouse.Icon = "rbxassetid://108280799"
script.Parent.Activated:Connect(function()
if Ammo1>0 and not reloading then
Ammo1 = Ammo-1
if mouse.Target.Parent:FindFirstChild("Humaniod") then
script.Parent.ShotsDamage:FireServer(mouse.Target.Parent, 100)
end
elseif Ammo<0 and reloading == false and Ammo > 0 then
reload()
else
print("No Ammo")
end
end)
local Input = game:GetService("UserInputService")
Input.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.R and reloading == false and Ammo1 <5 then
reload1()
end
end)
end)
Normal Script
script.Parent.ShotsDamage.OnServerEvent:Connect(function(Player, Target, Damage)
Target.Humanoid:TakeDamage(Damage)
end)

1 comment
nvm found a error the error is mouse is not active