i am making a gun but this time instead of using a tool for it(you have to use the toolbar and I hate it) I placed the gun model inside the right arm of the character(yes it works fine) and inside I made the same script I would use for a tool but instead of tool.Activated I tried using the userinputservice but it does not work. i also made a new empty script inside the model just to make sure I didn’t do a mistake, and it didn’t work. then I tried UIS inside starterplayerscripts and it worked.
1 Like
User input service only works inside a local script and for the local script to run it needs to be placed as a descendant of the player character.
1 Like
Since UserInputService can only run when used in a LocalScript, and LocalScripts aren’t able to run inside of Workspace, you’ll need to copy your code and paste it to a server script located in your model, and set the server script’s RunContext
to Client
, which will make the server script behave as a LocalScript, and it will still be able to run inside of Workspace