So, I am trying to code some script that i forgot i had a long time ago and I keep on getting the error: "Workspace.InfOHac.fur:1486: attempt to index nil with 'InputBegan'". and it is annoying me a lot, my code is
UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(io, gpe, input, gameProcessed)
if(gpe or Attack)then return end
if(io.KeyCode==Enum.KeyCode.Q)then
Personality=Personality-1
if(Personality<1)then Personality=5 end
elseif(io.KeyCode==Enum.KeyCode.E)then
Personality=Personality+1
if(Personality>5)then Personality=1 end
elseif(io.KeyCode==Enum.KeyCode.Semicolon)then
ManualMode=true
elseif(io.KeyCode==Enum.KeyCode.R)then
ChangeStance'Sit'
elseif(io.KeyCode==Enum.KeyCode.F)then
ChangeStance'Auto'
end
end)
Can someone help me because it is getting me really annoyed and I don't know how to fix it.
Sorry if it is unreadable
Edit: Yes i did define UserInputService

2 comments
Did you define UIS?
If you defined UIS, then may you please add that so we know.