title so im attempting to make a gun and for the gui to change to the recoil image when you click what are some options for doing this?
COMMUNITY QUESTION
How do i make it so when i click (not the gui just anywhere) the gui changes?
1 answer
You can use the players mouse like this
-- In a local script
local Player = game.Players.LocalPlayer
-- You can get the players mouse input like this
local Mouse = Player:GetMouse()
-- And to detect when the player clicked anywhere
Mouse.Button1Down:Connect(function()
-- Put what you want to do when the player clicks in here
end)
And the Mouse has more Events, Values and stuff so if you want to check them out you can click on this link
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
hi, sorry for bothering you further im new to this, where do i put this script.
you can put this script in the gun you were making