How to check if screen is clicked
I am working on a simulator game, and wanted to know, how to games like bubble gum blowing simulator check if anywhere on the screen is clicked without using Gui's or tools?
I am working on a simulator game, and wanted to know, how to games like bubble gum blowing simulator check if anywhere on the screen is clicked without using Gui's or tools?
Just use UserInputService
. Listen for InputBegan
, then check if the input type is MouseButton1
.
game:GetService("UserInputService").InputBegan:Connect(function(input, engine_processed)
if engine_processed then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print("Yes")
end
end)
doesn’t work, just tried it and does nothing,
is there a certain place im meant to be putting the script?
Should be using a local script. PlayerScripts is a good place to put it.
Yes, try Startergui. It must be a localscript