#How to make a click detector

8 messages · Page 1 of 1 (latest)

paper musk
#

Im new to coding, and i've wanted to make something easy like a clicker game. How do i exactly make a script, that detects player's clicks and rewards him with something. Every tutorial i've seen shows only how to make the clicking through a GUI button, but i cannot make a gui button work on every part of the screen. Can someone please help me?

molten narwhal
#

You want the client to click and server to register it?

paper musk
molten narwhal
#
-- sending a signal (local script)
RemoteEvent:FireServer()
-- recieving a signal (server script)
RemoteEvent.OnServerEvent:Connect(function(player: Player)
  -- do stuff with it here
end)

edit: it's OnServerEvent if you're sending from a client, not OnClientEvent :)

paper musk
#

Thank you so much! Appreciate it chad

molten narwhal