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

Help with keyboard press finding Character, nil Value?

Asked by 7 years ago

I need this script to find the Player's Character, but it always says:

118:41:52.896 - Players.TinyScripter.PlayerScripts.KeyboardControls:11: attempt to index upvalue 'Face' (a nil value)
218:41:52.897 - Stack Begin
318:41:52.898 - Script 'Players.TinyScripter.PlayerScripts.KeyboardControls', Line 11
418:41:52.899 - Stack End

Here is the script:

01game:GetService("UserInputService").InputBegan:connect(onKeyPress)
02game:GetService("UserInputService").InputBegan:connect(onKeyPress)
03local UserInputService = game:GetService("UserInputService")
04local NewFa = game.Players.LocalPlayer.NewFa
05local Face = game.Players.LocalPlayer.Character
06function onKeyPress(inputObject, gameProcessedEvent)
07    if inputObject.KeyCode == Enum.KeyCode.F then
08 
09    if NewFa.Value == false then
10    NewFa.Value = true
11    Face.Head.face.Transparency = 1
12    local Facez = Face.Head.face:Clone()
13    Facez.Transparency = 0
14    Facez.Name = "facez"
15    Facez.Image = ("rbxassetid://918741416")
View all 24 lines...

Answer this question