I have an exclamation mark that I use as a quest giver but I haven't programmed in a long time so I forgot almost everything. I want the player to be able to click on the exclamation mark, and then have a gui pop up describing the quest, or just any info. Can anyone give the me on click function? If it has to create a gui with Instance.new then so be it.
✓ ANSWER ACCEPTED
How do I program an on-click function?
1 answer
✓ Accepted answer
First, add a click detector to the exclamation mark and modify it to whatever you want. Next get the click detector's path (EX. game.Workspace.Model.ClickDetector) and then add the MouseClick event to it like so:
game.Workspace.Model.ClickDetector.MouseClick:connect(function()
--code goes here
end
After that you will need to open the gui, so you will need the gui's path. Then you will need to make the .Visible property to true so it will appear on their screen.
game.Workspace.Model.ClickDetector.MouseClick:connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.Gui.Visible = true;
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
