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

How do you create a mouse clicking function on local script on roblox studio? [closed]

Asked by 6 years ago

This question already has an answer here:

How to make ti that if u left click you punch on roblox studio?

I wana to know so i can make a game

Marked as Duplicate by User#19524

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 6 years ago

If you are talking about when a player clicks on a gui, then

local Button = script.Parent
Button.MouseButton1Click:Connect(Function()
--Your Code Here
end

Make sure to put this script in a textbutton or an imagebutton

Ad
Log in to vote
0
Answered by 6 years ago

If you want to just check if the player makes a mouse click in general, then this code will be right for you.

-- This should be in a local script
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.Button1Down:connect(function()
-- When you press the button
end)
mouse.Button1Up:connect(function()
-- When you let go of the button
end)