MouseButton1down not being detected?

i was in the middle of wworking on a combat system i wanted too test if my mouse button down was working right so i put in a print statement but nothing was in the output there were no errors, can someone help? ```lua
local animationIsPlaying = false
local anims = {script:WaitForChild(“Punch1”), script:WaitForChild(“Punch2”), script:WaitForChild(“Punch3”), script:WaitForChild(“Punch4”), script:WaitForChild(“Punch5”) }

local char = script.Parent
local hum = char:WaitForChild(“humanoid”)

local remote = game:GetService(“ReplicatedStorage”)

local loadanimation
local currentanimation

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Mouse.Button1Down:Connect(function()

print("hi")

end)

Could you try changing the player line to the first line?

For those who can’t read it well, this is the script.

local animationIsPlaying = false
local anims = {script:WaitForChild(“Punch1”), script:WaitForChild(“Punch2”), script:WaitForChild(“Punch3”), script:WaitForChild(“Punch4”), script:WaitForChild(“Punch5”) }

local char = script.Parent
local hum = char:WaitForChild(“humanoid”)

local remote = game:GetService(“ReplicatedStorage”)

local loadanimation
local currentanimation

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
Mouse.Button1Down:Connect(function()

print("hi")
end)

1 Like

it does not matter where it is its out of the scope everything can access it put it too the top just incase but still no detection

local hum = char:WaitForChild(“humanoid”)
i think the humanoid should change to Humanoid

Well, to me it seems like you have not identified the;

local loadanimation,
local currentanimation

those are nil for a reason, those values will help direct the script if the animation is loaded and what the current anim is. also the problem is withn the mouse statement

the mouse is where the problem is, and thank you i will change that.

Try;

Mouse.MouseButton1Down

that causes a error sence the statement"button1down" is a function and needs that in order too work it may be a bug with studio

Ok, I used the one you have in your script and it works fine for me… Must be a bug or its just the invalid locals

2 Likes

yeah thought so. i restarted studio