【发布时间】:2021-10-25 12:36:49
【问题描述】:
如何使用 if 语句检查某个部分是否已被点击? 也不是gui 这是我写的一些代码:
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 chosen
print("Pizza has been chosen")
if -- Here I want to check if a button has been clicked
elseif chat.InitialPrompt == "fries" then -- checks what have random item has been chosen
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 chosen
print("Burger has been chosen")
if -- Here I want to check if a button has been clicked
else
print("Error")
end
这是我能解释的最好的了????
【问题讨论】: