Help with keyboard press finding Character, nil Value?
I need this script to find the Player's Character, but it always says:
1 | 18 : 41 : 52.896 - Players.TinyScripter.PlayerScripts.KeyboardControls: 11 : attempt to index upvalue 'Face' (a nil value) |
2 | 18 : 41 : 52.897 - Stack Begin |
3 | 18 : 41 : 52.898 - Script 'Players.TinyScripter.PlayerScripts.KeyboardControls' , Line 11 |
4 | 18 : 41 : 52.899 - Stack End |
Here is the script:
01 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
02 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |
03 | local UserInputService = game:GetService( "UserInputService" ) |
04 | local NewFa = game.Players.LocalPlayer.NewFa |
05 | local Face = game.Players.LocalPlayer.Character |
06 | function onKeyPress(inputObject, gameProcessedEvent) |
07 | if inputObject.KeyCode = = Enum.KeyCode.F then |
09 | if NewFa.Value = = false then |
11 | Face.Head.face.Transparency = 1 |
12 | local Facez = Face.Head.face:Clone() |
13 | Facez.Transparency = 0 |
18 | Face.Head.face.Transparency = 0 |
19 | Face.Head.facez:Destroy() |
24 | game:GetService( "UserInputService" ).InputBegan:connect(onKeyPress) |