代码之家  ›  专栏  ›  技术社区  ›  Paul

如何使本地分配的衣服对所有玩家可见?

  •  0
  • Paul  · 技术社区  · 4 年前

    查看源代码

    01  local player = game.Players.LocalPlayer
    02   
    03  local char = player.Character or player.CharacterAdded:Wait()
    04   
    05  local shirt
    06   
    07  if player.Team == game.Teams["Red Team"] then
    08  shirt = "http://www.roblox.com/asset?id=73022512"
    09  elseif player.Team == game.Teams["Blue Team"] then
    10  shirt =  "rbxassetid://184244692"
    11  elseif player.Team == game.Teams["Yellow Team"] then
    12  shirt = "http://www.roblox.com/asset/?id=1210716332"
    13  elseif player.Team == game.Teams["Green Team"] then
    14  shirt = "http://www.roblox.com/asset/?id=13997666"
    15  end
    16   
    17  if char:FindFirstChild("Shirt") then
    18  char.Shirt.ShirtTemplate = shirt
    19  else
    20  local newShirt = Instance.new("Shirt")
    21  newShirt.Parent = char
    22  newShirt.ShirtTemplate = shirt
    23  end
    

    0 回复  |  直到 4 年前
        1
  •  0
  •   Vector3    4 年前
    game.Players.PlayerAdded:Connect(function(plr)    
    
        plr.CharacterAdded:Connect(function(char)
              -- here check the player's team and change the shirt
        end)
    
    end)
    

    试试这个办法。