Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to check if player clicked number 1 or 2 or 3? (without tools)

I need start function when player clicked one of this numbers (1, 2, 3) you can use anything, mouse or UIS. Just this script should work.

And yes if you clicked 1 - 3 there's should be any print

2 answers

✓ Accepted answer

You can make LocalScript and put in into StarterPlayerScripts:

local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:Connect(function(key) key = key:lower() if key == "1" then print(game.Players.LocalPlayer.Name .. " pressed 1!") end end)

You can change key == "to any key you want to".

1 comment

0

Use a code block

You can make LocalScript and put in into StarterPlayerScripts:

local mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:Connect(function(key) key = key:lower() if key == "1" then print(game.Players.LocalPlayer.Name .. " pressed 1!") end end)

This discussion is preserved as it was. New answers, comments, and votes are closed.