所以,我正在制作一个Roblox游戏,这是一个战斗游戏。我想做一个现金换杀死脚本,意思是每杀一次,杀手得到+10现金,而你一开始只有0现金。我已经有了一个脚本,如下所示。我在网上什么都试过了,但都不管用。即使是工具箱里的那些。但它不是给杀手现金,而是给被杀的人现金!我不想让它成为一个致命的杀手稿!这是代码我有另一个类似的问题,它不会有帮助。它没有用(它有排行榜,被杀的人得到+10现金。):
game.Players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder",player)
folder.Name = "leaderstats"
local currency1 = Instance.new("IntValue",folder)
currency1.Name = "Cash"
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
currency1.Value = currency1.Value + 10 --This is the reward after the
player died.
end
end
end)
end)
end)提前感谢,希望你们能帮上忙!
发布于 2018-06-22 11:34:51
如果不手动跟踪这些信息,就无法确定玩家A杀死了玩家B。
例如,如果玩家A开了一把枪,它产生的子弹可能有一个附加的ObjectValue,带有玩家A的humanoid的Value。
当子弹与玩家B相撞时,你可以很容易地参考回玩家A,并可以将KO归功于他们。
https://stackoverflow.com/questions/50979542
复制相似问题