【发布时间】:2022-01-29 13:39:44
【问题描述】:
我再次在 Roblox 中,我想制作一个脚本,当我的工具被激活时,它会在我的文本标签中添加 1。示例:如果文本标签为零,则激活工具,将其更改为 1,如果为 1,则变为 2,依此类推。这是我的脚本:
script.Parent.Activated:Connect(function()
game.Players.LocalPlayer.PlayerGui.ScreenGui.cashcount.Text = game.Players.LocalPlayer.PlayerGui.ScreenGui.cashcount.Text + 1
end)
【问题讨论】:
-
当您提出问题时,您应该详细说明问题所在和/或您收到的错误消息。
-
既然你不说出了什么问题,那就有点难以猜测了。但您似乎正在尝试将整数添加到字符串中。在Lua中不能这样做。也许可以试试
a = tonumber(game.Players.LocalPlayer.PlayerGui.ScreenGui.cashcount.Text)、a=a+1、game.Players.LocalPlayer.PlayerGui.ScreenGui.cashcount.Text = a。