Click Divide to chat not working

my script:

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.KeypadDivide then
		game:GetService("StarterGui").ChatGui.Enabled = true
		game:GetService("StarterGui").ChatGui.Message:CaptureFocus()
	end
end)

local script, starterplayerscripts.

2 Likes

May I ask what the purpose is?

Pressing KeypadDivide will open & focus on the chat. Is there something in the code I’m missing? Or is this what you are trying to do?

yes, that is what i am trying to do, but i already disabled the default chat.

Okay. I see. Do you know where the issue is more specifically?
Does the code within the if-statement run? (Tested a print in there perhaps?)

Just asking to make sure whether it is the if-statement or the code within it which doesn’t work.

yes, it does print “Yes”.

My bad. I think I see the issue.

You are asking for the service “StarterGui”, however if you want to make changes to a UI which is on a player you must make those changes to Player.PlayerGui.<your gui>. StarterGui is what the player copies upon spawning/joining if I’m not mistaken.

yeah! i just did not notice cause i forgot