Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

button1click is not a valid member of PlayerMouse?

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

✓ Accepted answer

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.

1 comment

0

if the player dies, they cant swing on respawn

This discussion is preserved as it was. New answers, comments, and votes are closed.