How to make camera offset when right mouse button was click or by an ui button on mobile

Im currently making a custom aim button for my own gun system, when i camera offset it work very good but i dont know how to make it work with ui button or mouse click.
I havent make any script for it because i dont have any ideas on how to make it

1 Like

For button:

local aiming = false
button.MouseButton1Down:Connect(function()
	-- Flip the aiming boolean to keep track of if the player is aiming or not --
	aiming = not aiming
	
	if aiming then
		-- Move camera to aiming position --
	else
		-- Move camera to default position --
	end
end)

This general idea can be tweaked to suit your needs. Hope this helps!

1 Like

Hey it work for me thanks for ur help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.