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

I don't know the name of this function?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)

0
LOOOOOOOOOL RandyN56 23 — 3y
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? surviarlTheJefkillre 55 — 3y
Ad

Answer this question