So I have this LocalScript that's connected to a RemoteEvent, that changes a players shirts and pants when they are on a specific team. This works, but if you look at another player, their clothes don't appear, and vice versa. The script is located in StarterGui, but when I try to move it to a different location, the script breaks. Help?

local player = game.Players.LocalPlayer
local character = player.Character

player:WaitForChild("cEvent").OnClientEvent:connect(function()
    if player.TeamColor == game.Teams["Axis Forces"].TeamColor then --[[ This will get the teamname, instead of the color... so you will need to change 'Bright red Team' to the team you wish to have. ]]
        if character:FindFirstChild("Shirt") then
            character.Shirt:Destroy()
        end
        if character:FindFirstChild("Pants") then
            character.Pants:Destroy()
        end
        Instance.new("Shirt",character).ShirtTemplate = "http://www.roblox.com/asset/?id=356273812"
        Instance.new("Pants",character).PantsTemplate = "http://www.roblox.com/asset/?id=356262036"
    end
end)

5 comments

1

If FE is on, you will need the server to do the clothes thing

0

Yes, there is a script in ServerScriptService that is connected to this..but what do you mean by server needs to do it?

0

When you make changes to the Rendered Game with FE on from the client, other clients will not be able to see it. Like theCJarmy7 said, you'll need to change the clothing from the server instead.

0

How would I do that?

0

You would need to have the script in serverscriptservice do it instead