You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Useing or imitate UserInputService in server script?
What is the issue? Just a question.
What solutions have you tried so far? Chatgpt, google, work arounds, 2 hours of trying something similar that didn’t work.
local tool = script.Parent
local NonEquip = Color3.new(0.266667, 0.278431, 0.294118)
local Equip = Color3.new(0, 0.67451, 0.988235)
local UserInputService = game:GetService("UserInputService")
local function onInputBegan(input, _gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.C then
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.X then
tool.B.Enabled = false -- resets the script to the start
tool.V.Enabled = false -- resets the script to the start
tool.N.Enabled = false -- resets the script to the start
tool.C.Enabled = false -- resets the script to the start
wait(5)
tool.B.Enabled = true -- resets the script to the start
tool.V.Enabled = true -- resets the script to the start
tool.N.Enabled = true -- resets the script to the start
tool.C.Enabled = true -- resets the script to the start
end
end
end
end
end
UserInputService.InputBegan:Connect(onInputBegan)
You can’t. But what you can do is send the input to the server via RemoteEvent and then handle your logic there.
But looking at your code, you are trying to manipulate UI elements as well, which you can only do on the client side. So maybe try to figure out what you want to do exactly and then split it into client and server code.
Kinda rude to assume I don’t know what I’m doing with the ui, that’s just left over script from my old duplicated script. This script is just one out of 5.
then its completely impossible
remote events are the only secure way to communicate between the client and the server
and userinputservice is not creatable (you cant recreate it) and only works on client
try adding security keys or smth that makes it very secure
I was thinking something more like this but for server scripts
local tool = script.Parent
local character = tool.Parent
local player = game.Players:GetPlayerFromCharacter(character)
local mouse = player:GetMouse()
–
mouse.KeyDown:Connect(function(key)
if key == “e” and tool:IsDescendantOf(player.Backpack) then
print(“Pressed e while tool is equipped”)
end
end)