Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

User input service is not printing anything, what i do?

Asked by 3 years ago
Edited 3 years ago

Idk what is happening, but it doesnt prints anything. I wanted to use this for playing a animation, but idk what to do... /:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(Input)
    print("a") 
    if Input.KeyCode == Enum.KeyCode.H then
        print("a")
    end
end)

i've made other script too, but it works, and the first one don't.

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if input.KeyCode == Enum.KeyCode.G then
        mouse.Target:Destroy()
        print(mouse.Target)
    end
end)

2 answers

Log in to vote
0
Answered by 3 years ago

UserInputService doesn't work on the server. Make sure this is in a LocalScript

0
it is dvnq_mito 0 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

I tried changing the location too, ti was on StarterCharacterScrpits bcuz i wanted to do a animation on it. Tested on workspace and still not working

0
it* dvnq_mito 0 — 3y

Answer this question