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

can you help me change the clothes ?

Asked by 6 years ago

hello, i am a beginner of scripting, but i don't know how to change cloth of the player, i want to put the line under player:LoadCharacter() (the value of the player is... player x) )

script

function remote.OnServerInvoke(player, TeamName)
    player.TeamColor = BrickColor.new(TeamName) -- Team Change
if player.TeamColor == BrickColor.new("New Yeller") then -- Searcher LVL 2
            player:LoadCharacter()


thanks you !

0
The question sounds like you need help changing your clothes* :P | Be more specific in the title. Jo_Bot 67 — 6y
0
XD , sorry for that sheppard929 9 — 6y

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
6 years ago
local function ChangeClothes(char, shirtid, pantsid)
    local shirt = char:FindFirstChildOfClass"Shirt" or Instance.new("Shirt", char)
    local pants = char:FindFirstChildOfClass"Pants" or Instance.new("Pants", char)
    shirt.ShirtTemplate = shirtid
    pants.PantsTemplate = pantsid
end

remote.OnServerInvoke = function(player, TeamName)
    player.TeamColor = BrickColor.new(TeamName)
    if TeamName == "New Yeller" then
        player:LoadCharacter()
        local char = player.Character or player.CharacterAdded:Wait()
        ChangeClothes(char, 263683661, 317425374) --replace with your desired ids
    end
end

Btw you should add additional security measures to ensure that exploiters can't use your remote function to assign themselves into any team they want.

0
Thanks you so much ! its working :D sheppard929 9 — 6y
0
and... small question , if i want remove all hats and add a new one , how i can do this ? sheppard929 9 — 6y
Ad

Answer this question