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

I don't know the name of this function?

I am trying to make it so it plays an animation when you click anywhere but I don't know what the proper thing to put after Mouse. I kind of suck at scripting so don't judge me if I'm way off with my code.

local Mouse = game.Players.LocalPlayer:GetMouse()

if Mouse.leftmousebuttondown then
	print("IT WORKED")
end

1 answer

✓ Accepted answer

The function name you’re thinking of is MouseButton1Down. Since it’s an event, you’d need to add connect to connect it to a function, and then (function() (since it’s required). You can read more about it on the dev wikia.

I fixed your code:


local Mouse = game.Players.LocalPlayer:GetMouse()
 
Mouse.MouseButton1Down:Connect(function()
    print("IT WORKED")
end

(If and then statements aren’t necessary in this case)

2 comments

0

LOOOOOOOOOL

0

It didn't print, could it be a problem with what type of script it is or where i put the script? or am i just off by a long shot with my script?

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