Hey, I have a local script where this makes a screenGui and a textButton and also if the players press Z, then the text of the textButton will change. Here's the script.
--Made By SirTwoFace
local screenGui = Instance.new("ScreenGui")
local textButton = Instance.new("TextButton")
screenGui.Parent = StarterGui
textButton.Parent = screenGui
textButton.Size = UDim2.new(0, 100, 0 , 200)
textButton.Position = UDim2.new(0, 500, 0 , 500)
textButton.Font = "Legacy"
textButton.BackgroundColor3 = BrickColor.Red().Color
textButton.TextColor3 = BrickColor.Gray().Color
textButton.Text = "Press Z!"
m.KeyDown:connect(function(key)
if key == "z" then
textButton.Text = "Thank you for pressing Z!"
wait(5)
textButton.Text = "Bye!"
wait(5)
textButton.Parent:Remove()
end
end)
I get a error at line 27 (or where m.KeyDown:connect(function(key) is. It's saying i'm calling M, a nil object. Help would me great!

1 comment
The error isn't there anymore, but the gui won't appear.