Lua 试图为ROBLOX游戏创造一个销售区域
我正试图为我的大厅做一个出售区域,用于ROBLOX游戏 然而,每当我踏上销售区域(带着积分),我似乎没有得到任何现金,我的积分也没有改变 请帮忙 这是我的密码:Lua 试图为ROBLOX游戏创造一个销售区域,lua,roblox,Lua,Roblox,我正试图为我的大厅做一个出售区域,用于ROBLOX游戏 然而,每当我踏上销售区域(带着积分),我似乎没有得到任何现金,我的积分也没有改变 请帮忙 这是我的密码: local sellPart = script.Parent game.Players.PlayerAdded:Connect(function(plr) sellPart.Touched:Connect(function(hit) local hrp = hit.Parent:FindFirstChild(&
local sellPart = script.Parent
game.Players.PlayerAdded:Connect(function(plr)
sellPart.Touched:Connect(function(hit)
local hrp = hit.Parent:FindFirstChild("HumanoidRootPart")
if hrp then
local player = game.Players:GetPlayerFromCharacter(hrp.Parent)
local zombpoints = player.leaderstats.Zombpoints
local zombcash = player.leaderstats.Zombcash
zombcash = zombpoints
zombpoints = 0
end
end)
end)
希望这有帮助。在代码中,您将NumberValue对象存储到变量中,然后覆盖这些变量。您没有修改存储在变量中的数据 因此,在使用时,需要显式设置它们的Value属性
-- get the point values out of the leaderstats
local zombpoints = player.leaderstats.Zombpoints
local zombcash = player.leaderstats.Zombcash
-- convert the points to cash and add it to cash pile
zombcash.Value = zomcash.Value + zombpoints.Value
-- reset the point counter
zombpoints.Value = 0