Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

button1click is not a valid member of PlayerMouse?

Asked by 7 years ago
Edited 7 years ago

Error occurs on the start of a test game.

Player = game.Players.LocalPlayer
Character = Player.Character
Humanoid = Character:WaitForChild("Humanoid")
Mouse = Player:GetMouse()
Anim = script.Swing
isswinging = false

Mouse.Button1Click:connect(function()
    if isswinging == false then
        isswinging = true
        local s = Humanoid:LoadAnimation(Anim)
        s:Play()
        wait(0.8)
        isswinging = false
    end
end)

1 answer

Log in to vote
0
Answered by 7 years ago

There is no function called Button1Click of Mouse.

Alternatively you could use

Mouse.Button1Down

Instead, and if you want as well, wait for the mouse to be released inside the function as well.

0
if the player dies, they cant swing on respawn pluginfactory 463 — 7y
Ad

Answer this question