【问题标题】:Are there anyways to make the StarterPack sends a tool to a specific player?有没有办法让 StarterPack 向特定玩家发送工具?
【发布时间】:2021-09-05 19:44:57
【问题描述】:

我制作了一个答题器,将我的武器从 ServerStorage 发送到 StarterPack,效果非常好。我之所以没有将工具发送到PlayerBackpack而不是StarterPack,这是因为我的战斗,动画系统在ServerScriptService中。我将它发送到 Player Backpack,但没有任何效果。但我发现将工具发送到 StarterPack 将使所有玩家能够在他们死亡时接收它。那肯定是个大问题。

所以,我的问题是:无论如何让 StarterPack 向特定玩家发送工具。例如:在大亨游戏中,如果您声称该房子,点击器会将工具发送给该房子的玩家,而不是其他人。

如果不可能,我会很高兴收到您的任何建议。

如果有必要,这是我的点击脚本..

local ClickDetector = script.Parent.ClickDetector
local canGiveGun = true


ClickDetector.MouseClick:Connect(function(player)
    local starterpack = game.StarterPack
    local MetalBatCombat = game.ServerStorage:FindFirstChild("MetalBatCombat")
    local batClone = MetalBatCombat:Clone()

    for i,v in pairs(starterpack:GetChildren()) do
        if v.Name == "MetalBatCombat" then
            canGiveGun = false
        end
    end

    if canGiveGun then
        batClone.Parent = starterpack
        local char = player.Character
        local human = char.Humanoid
        human.Health = 0
    end

    canGiveGun = true

end)

【问题讨论】:

    标签: lua roblox


    【解决方案1】:

    我会将金属球棒放入ReplicatedStorage 并将其克隆到玩家的背包中:

    local MetalBatCombat = game.ReplicatedStorage:FindFirstChild("MetalBatCombat")
    --Code
    MetalBatCombat:Clone().Parent = player.Backpack
    

    这将确保只有玩家获得金属球棒。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-21
      相关资源
      最近更新 更多