Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make players in a Team wear their own clothing?

Asked by 3 years ago
Edited 3 years ago

Hi, I am currently working on a cafe game and I want that only the Barista-Team has a job outfit. How do I make the Costumer-Team have their own clothing? This is what my script looks like now:

local ss = game:GetService("ServerStorage")

game.Players.PlayerAdded:Connect (function (player)
    player.CharacterAdded:Connect (function (character)
        if player.Team == game.Teams.Barista then 

        local shirt = character:WaitForChild("Shirt")
        local pants = character:WaitForChild("Pants")

            shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=000000"
            pants.PantsTemplate = "http://www.roblox.com/asset/?id=00000"
                local hat = nil 
                hat = ss:WaitForChild("hat"):Clone()
            local hum = character:WaitForChild("Humanoid")
            hum:AddAccessory(hat)
        end 
    end)
end)

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
local ss = game:GetService("ServerStorage")
local Teams = game:GetService'Teams'

game.Players.PlayerAdded:Connect (function(player) 
    player.CharacterAdded:Connect (function (character)
        if player.Team == Teams.Barista then

            local shirt = character:WaitForChild("Shirt", 5)
            local pants = character:WaitForChild("Pants", 5)


            if shirt and pants then -- pretty sure avatars can be made without clothes
                shirt.ShirtTemplate = "000000" -- pretty sure just need id not link
                pants.PantsTemplate = "00000"
            else
                Instance.new('Shirt', character).ShirtTemplate = '000000'
                Instance.new('Pants', character).PantsTemplate = '00000'
            end


            local hat = nil 
            hat = ss:WaitForChild("hat"):Clone() 
            local hum = character:WaitForChild("Humanoid")
            hum:AddAccessory(hat)

        elseif player.Team == Teams.Customer then -- if not barista then check for customer

-- give customer clothing (can be same as Barista with dif id)

        end
    end)
end)

{"mode":"full","isActive":false}
0
I tried it and it worked! But if the player switches team it won't change the outfit Imnogst 0 — 3y
0
use team.playeradded or getpropertychangedsignal i think also works [for both just run same code again] or just respawn character BulletproofVast 1033 — 3y
Ad

Answer this question