How to check the Players UserId that is trying to use UserInputSerivce

Hey, so pretty much what I am trying to do is check to see if a player who is attempting to press “V” is in a table. If they are in the table, it should return nil. If the players UserId is not in the table, it should print “Running”. Is there a way to do this? Or atleast something like this?

Well, when the user is hit, simply loop through the table and check to see if said players ID matches.

NOTE: Mouse is deprecated, meaning it will not get further updates. Use UserInputService instead.

--Put this in a local script in StarterCharacterScripts
local player = game.Players.LocalPlayer
local players = {0, 1} --ID's here
local mouse = player:GetMouse()

	if key == "v" then
		--Code here

1 Like

Shoot my bad, ill delete this after

No need, I’d just move it to #help-and-feedback:scripting-support(edit your topic, then at the topic change the category).

Say your trying to fireserver from a localscript. Is there a way to use UIS in the onserverevent statement?

Don’t use the key related events with mouse, they are deprecated.

You could theoretically wait for the response client side, then fire a Remote Event when a user triggers the key press. This would allow you to send all necessary data to the server.

Oh, I didn’t realize that. Will update my post to contain this.

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