我正在努力做到这一点,以便当您单击某个对象时,会出现一个文本框,根据您单击的内容,文本会有所不同,但是由于某些原因,它将无法正常工作。我认为这是因为我错误地指定了GUI,但是我不知道如何正确地进行操作。
我尝试过更改StarterGui和PlayerGui,但似乎都没有用。请告诉我我在做什么错。另外,该游戏是单人游戏,因此无需指定它仅影响一个人。
local Box = game.PlayerGui.ScreenGui.TextBox
local function onClick(playerWhoClicked)
game.PlayerGui.ScreenGui.Enabled = true
if workspace.Clues.test.Value == 1
then
Box.Text = "Your masters words echo in your head: wi can has can, but wi can't has this yet"
wait (5)
game.PlayerGui.ScreenGui.Enabled = false
else
Box.Text = "Filipe has been murdered??!?!?"
wait (5)
game.PlayerGui.ScreenGui.Enabled = false
end
end
script.Parent.MouseClick:Connect(onClick)
我很确定有办法做到这一点,但我不知道怎么做
对于所有玩家都是。
local Box = <YOUR TEXTBOX>
local function onClick(playerWhoClicked)
Box.Enabled = true
if workspace.Clues.test.Value == 1 then
Box.Text = "Your masters words echo in your head: wi can has can, but wi can't has this yet"
wait (5)
Box.Enabled = false
else
Box.Text = "Filipe has been murdered??!?!?"
wait (5)
Box.Enabled = false
end
end
script.Parent.MouseClick:Connect(onClick)
问题在于文本框的位置,因为“ game.PlayerGui”不是“ game.Players.PlayerGui”(我希望这会有所帮助。)