In one of my weapon local scripts, I was noticing that if I unequipped the weapon while the cooldown was active, then the weapon was able to work without it being equipped. The output bar was empty of errors, so I didn't know what to do. Here's the animation script-
player = game.Players.LocalPlayer
mouse = player:GetMouse()
animation = script:WaitForChild("Animation2")
enabled = false
cananim = script.Parent.Parent.Equipped
script.Parent.Parent.Equipped:Connect(function(mouse)
enabled = true
end)
mouse.Button1Down:connect(function()
if enabled then
enabled = false
local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
animationTrack:Play()
wait(.8)
enabled = true
end
script.Parent.Parent.Unequipped:connect(function()
enabled = false
end)
end)
And here's the attack script-
local Water = game.ReplicatedStorage.Water
local Shooter = script.Parent
local Waterclone = Water:Clone()
local Enabled = false
local person = game.Players.LocalPlayer
local mouse = person:GetMouse()
local Cooldown = wait (.8)
Shooter.Unequipped:Connect(function()
if Enabled then
Enabled = false
end
end)
Shooter.Equipped:Connect(function()
if Cooldown then
wait(.1)
Enabled = true
end
end)
local function onclick()
if Enabled then
Enabled = false
if person.Character ~= nil then
Waterclone.Parent = game.Workspace
Waterclone:MoveTo(person.Character:FindFirstChild('RightLowerLeg').Position)
wait(.8)
Waterclone.Parent = nil
Enabled = true
end
end
end
mouse.Button1Down:Connect(onclick)
Anyone know an fix?

4 comments
It may be because local scripts can only work in certain places in the game. So when the tool is equipped it works in the players backpack, but when it is unequipped it is moved to a place where local scripts dont work.
ill see if that is a fix
now i can't access localplayer anymore
Now that im coming back to this im pretty sure your comment is the answer lol