Well, actually its kind of useless because the only instance in the game that has a mouse is the Player
But if you want it in the parameter then its reasonable
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
local function CheckPlayer()
Mouse.Button1Down:Connect(function(player)
if player.AccountAge == 2006 then
print("You are a roblox veteran")
end
end)
end
Hope you understand..
If you want UserInputService then
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Q then
print("You pressed Q")
end
end)
I know this has got nothing with your answer but there is something called InputEnded
InputEnded basically fires something when the player lets go of the key
Lets try again
local UIS = game:GetService("UserInputService")
local IsPlayerHoldingKey = false
UIS.InputBegan:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Q then
IsPlayerHoldingKey = true
while IsPlayerHoldingKey do
wait()
print("Player is holding down the A Key")
end
end
UIS.InputEnded:Connect(function(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.Q then
IsPlayerHoldingKey = false
end
end)
end)
So that script detects if the player is holding the key and while they are holding it down it will run that function
If there are any questions please consider commenting
2 comments
Why do you need to use UserInputService exactly?
@AddisonAvery I'm trying to get the player name when user click on the other player in order to create a single target skill. And I'm not allowed to use GetMouse()