I wana to know so i can make a game
COMMUNITY QUESTION
How do you create a mouse clicking function on local script on roblox studio?
2 answers
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
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.
