Answered by
6 years ago Edited 6 years ago
The issue here is that you're changing the Gui object in StarterGui
. Once the character loads, contents of StarterGui
are cloned into the respective player's PlayerGui
folder. Therefore, we need to access the Gui from there. Additionally, :connect()
and :service()
are deprecated. Use :Connect()
and :GetService()
, respectively.
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local Players = game:GetService( "Players" ) |
03 | local player = Players.LocalPlayer |
05 | UIS.InputBegan:Connect( function (key,gameProc) |
07 | if key.KeyCode = = Enum.KeyCode.E then |
08 | local gui = player.PlayerGui:FindFirstChild( "ScreenGui" ) |
10 | gui.Input.Visible = true |
Accept and upvote if this helps!