Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my GUI not changing from a script? It should be saying yes or yo when I press a button.

Here is the localscript on a ScreenGui object, wordDis is also a child of ScreenGUI. `` function displayWord(key)

if(key == Enum.KeyCode.R) then
	script.Parent.wordDis.Text = "yes"
end

if(key == Enum.KeyCode.F) then	

	script.Parent.ScreenGUI.wordDis.Text = "yo"
end


end



game:GetService("UserInputService").InputBegan:connect(displayWord)

2 comments

0

I am still figuring out how to use the formatting on here XD

0

What does the output say? Also, do not use brackets on the "IF" statements.

1 answer

✓ Accepted answer

key is not actually the keycode. key is actually an InputObject. To get the KeyCode, you must use key.KeyCode instead.

Source

2 comments

0

thank you so much, I have been trying to get this for about an hour now and finally resorted to use this website. I'm glad I did. :)

0

No problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.