How do I use an if statement to check if a part has been clicked on? I'm using an If statement because... I really don't know how to explain it you'll understand when you read the script
local chat = game.Workspace.Dummy1.Head.Dialog
local Menu = {"pizza","fries","hamburger"}
local Item = math.random(1,#Menu) -- chooses random Item from the table
chat.InitialPrompt = (Menu[Item]) -- says random item
local PizzaButton = game.Workspace.PizzaButton -- a variable for the button
local FriesButton = game.Workspace.FriesButton -- a variable for the button
local BurgerButton = game.Workspace.BurgerButton -- a variable for the button
if chat.InitialPrompt == "pizza" then -- checks what have random item has been choosen
print("Pizza has been choosen")
if -- Here I want to check if a button has been clicked
elseif chat.InitialPrompt == "fries" then -- checks what have random item has been choosen
print("Fries has been chosen")
if -- Here I want to check if a button has been clicked
elseif chat.InitialPrompt == "hamburger" then -- checks what have random item has been choosen
print("Burger has been choosen")
if -- Here I want to check if a button has been clicked
else
print("Error")
end
I hope you understand I'm not really good at explaining.. Also it is NOT a gui
Edit: Ok I am trying to make something like pizza place where the customer orders something random and you have to press a button so you could complete the order I hope this makes it easier to understand :)

1 comment
What are you trying to detect a part getting clicked or a GUI button?