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

How do I make a Frame become visible in a ClickDetector AND change the text in a TextBox?

Asked by 6 years ago

So I'm currently scripting a custom NPC chat that utilizes a GUI in StarterGui. Basically, if you click the NPC you should be able to make that Frame in StarterGui visible, and it activates all of the text boxes inside of it. I got that part working. However, I can't figure out how to make the text change in the same script. Did I incorrectly script it? This is the script I managed to make:

local function click(player)
    player.PlayerGui.ScreenGui.Frame.Visible = true
    player.PlayerGui.ScreenGui.Frame.Name.Text = "Help-Bot"
    player.PlayerGui.ScreenGui.Frame.Description.Text = "Hi! I am here to help you!"
end
script.Parent.ClickDetector.MouseClick:connect(click)

"Name" is the title of one TextBox, while "Description" is a title of another.

0
You can't get pleyer on a normal script, it must be a Local script on the player Leamir 3138 — 6y
0
Ignore him, yes you can. The issue, assuming you have FilteringEnabled on, is that you can't access PlayerGui from the server. You can, however, create things and put them in PlayerGui from the server. Gey4Jesus69 2705 — 6y
0
I didn’t enable FilteringEnabled because it’s a one player game so I could care less what players do to the servers. If they exploit it, cool, no one else will see it. Astrabar 1 — 6y

Answer this question