您可以在销售过程中使用 for 循环吗?
我试图在Roblox进行销售过程,并想进行销售&窃取系统。简而言之,当您窃取项目时,它会进入文件夹。然后,当您出售时,我有一个循环,我想处理的方式是在文件夹中有很多项目,这就是您得到的钱。 脚本:
local Items = game.Workspace["BackpackCurrency's"]:GetChildren()
game.Workspace["Seller man"].UpperTorso.ProximityPrompt.Triggered:Connect(function()
for i, v in pairs(Items) do
game:GetService('Players').LocalPlayer.leaderstats.Credits.Value = game:GetService('Players').LocalPlayer.leaderstats.Credits.Value + tonumber(i)
end
end)
I tried to make a selling process in Roblox and wanted to make a selling & stealing system. Simply put, when you steal the item, it goes into a folder. Then when you sell, I have a for loop and the way I want to process to go is however many items are in the folder, that is how much money you get.
script:
local Items = game.Workspace["BackpackCurrency's"]:GetChildren()
game.Workspace["Seller man"].UpperTorso.ProximityPrompt.Triggered:Connect(function()
for i, v in pairs(Items) do
game:GetService('Players').LocalPlayer.leaderstats.Credits.Value = game:GetService('Players').LocalPlayer.leaderstats.Credits.Value + tonumber(i)
end
end)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)