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

I need help with a Team Auto Clother!?!

Asked by 4 years ago

So I need help with a Team Auto Clother. I don't even know were to start. I am really new to scripting too.

0
just how new are you? Benbebop 1049 — 4y
0
Um I started around 2 weeks ago BMA_Onkill -1 — 4y
0
Glad you're interested in scripting! I hope all goes well. This video should give you a head start. It shows you how to make what you're asking for. https://www.youtube.com/watch?v=m3pG3tjQLog royaltoe 5144 — 4y
0
It unfortunately doesn't explain the code. If you are confused about the code or if there's anything you want to do differently, hit me up on discord and I can help explain it to you. Lucy #4854 royaltoe 5144 — 4y
View all comments (2 more)
0
oK tHANK YOU BMA_Onkill -1 — 4y
0
caps BMA_Onkill -1 — 4y

1 answer

Log in to vote
0
Answered by
royaltoe 5144 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

If anyone else is viewing this thread, OP followed this tutorial to figure out how to change teams / shirts of the teams by using this tutorial

Instead of changing the player's clothes every time the player reset, BMA wanted the player's clothes to change whenever the player clicked a button.

We had to use remote events to change the player's team after they clicked a button.

We created a remote event called ChangeTeam which was fired whenever the player clicked the button to change their team.

The code for this was inside a localscript inside the button that the player was supposed to click:

changeTeam = game.ReplicatedStorage.ChangeTeam 

script.Parent.MouseButton1Click:Connect(function()
    changeTeam:FireServer("Team2") --tell the server that we want to change the player's team to team2 by firing a remote event with the name of the team we want to change the player's team to
end)

Once we fired the remote event, we changed the team on the server:

--changes the players team
changeTeam = game.ReplicatedStorage.ChangeTeam 

changeTeam.OnServerEvent:Connect(function(player, teamToChangeTo)
    player.Team = game.Teams[teamToChangeTo]
end)

we also had a function on the server to change the players clothes whenever their team changed:

game.Players.PlayerAdded:Connect(function(player)
    --this function changes the player's clothes when their team changes
    player:GetPropertyChangedSignal("Team"):Connect(function()
        local character = player.Character
        if(player.Team == game.Teams["Team1"] then
character:WaitForChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=(ID HERE)"
character:WaitForChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=(ID HERE)"
        end
    end)

    --this function makes sure the player's clothes changes whenever they resets / joins the game
    player.CharacterAdded:Connect(function(character)
                local character = player.Character
        if(player.Team == game.Teams["Team1"] then
            character:WaitForChild("Shirt").ShirtTemplate = "rbxassetid://(your asset id here)"
            character:WaitForChild("Shirt").PantsTemplate= "rbxassetid://(your asset id here)"
        end
    end)
end)
Ad

Answer this question