Hi, I have a local script that assigns shirts to players according to which team they are on. Here is the script:
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local shirt
if player.Team == game.Teams["Red Team"] then
shirt = "http://www.roblox.com/asset?id=73022512"
elseif player.Team == game.Teams["Blue Team"] then
shirt = "rbxassetid://184244692"
elseif player.Team == game.Teams["Yellow Team"] then
shirt = "http://www.roblox.com/asset/?id=1210716332"
elseif player.Team == game.Teams["Green Team"] then
shirt = "http://www.roblox.com/asset/?id=13997666"
end
if char:FindFirstChild("Shirt") then
char.Shirt.ShirtTemplate = shirt
else
local newShirt = Instance.new("Shirt")
newShirt.Parent = char
newShirt.ShirtTemplate = shirt
end
This works. Problem is, other players can't see your shirt as it's only local. I can't paste this post on a server side script because - as far as I know - you can't access a character on a server side script. Am I right in assuming this? How would I make all shirts visible to all players? Thanks

3 comments
Players.LocalPlayer is nil to the server because the server has no concept of "local player" otherwise that would defeat the purpose of a server. You can definitely get the character on the server.
how do you get the character on the server?
This doesn't work: local Players = game:GetService("Players") for i, player in pairs(Players:GetPlayers()) do -- put my code here end