Hrph。下面的代码有什么问题吗?欢迎任何改进
local function OnPlayerJoin(player)
local leaderstats = Instance.new ("Folder")
local currency1 = Instance.new ("IntValue")
leaderstats.Name = "leaderstats"
currency1.Name = "Gold"
leaderstats.Parent = player
currency1.Parent = leaderstats
game.Players.CharacterAdded:connect(function(character)
local Humanoid.Died:connect(function()
if Humanoid:FindFirstChild("creator") ~=nil then
local killer = Humanoid.creator.Value
currency1 = currency1 + 5
end
end)
end)
game.Players.PlayerAdded:Connect(OnPlayerJoin)
end
答案 0 :(得分:0)
我目前在此脚本上只能找到的唯一问题是
currency1 = currency1 + 5
应该在哪里
currency1.Value = currency1.Value + 5
由于“ currency1”是一个对象,但它的值是一个属性,如果此答案不能解决问题,请附上您遇到的错误的屏幕截图,并向我们展示杀死玩家的武器脚本。