I want to make it so when someone clicks on the NPC, the dialog would pop-up. However, I tried to do so but just can't do it. Here are script that I tried:
01 | AS = script.Parent -- NPC |
02 | GUI = script.Parent.FirstTextGui --- ScreenGUI |
03 | Frame = script.Parent.FirstTextGui.FirstTextBox -- Frame |
04 | Text = script.Parent.FirstTextGui.FirstTextBox.FirstText -- TextBox |
05 | Next = script.Parent.FirstTextGui.FirstTextBox.FirstText.NextButton -- TextButton |
06 | Talk = false |
07 |
08 | AS.MouseButton 1 Down:connect( function (talk) |
09 | if Talk = = false then |
10 | GUI.Enabled = true |
11 | Frame.Visible = true |
12 | Text.Visible = true |
13 | Next.Visible = true |
14 | end |
15 | end ) |
This is my first time coding in Lua so I need all of the help that I can get. If you could, please try to shorten down the script.
You would need to detect when a click detector is clicked. A clickdetector passes the play argument so you can find the GUI and make it visible from there.
http://wiki.roblox.com/index.php?title=API:Class/ClickDetector
Also, do make sure that for you to effectively and potentially interact with the screen GUI, it would have to be placed/copied into StarterGui. ClickDetectors CAN work in models in the right conditions, for your information.