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

Outfit is Local, not server-sided! Why?

Asked by 9 years ago

Ok, so I have a LocalScript, but I want the outfit to be seen by everyone and not just the player, meaning I need a normal script!

script.Parent.MouseButton1Down:connect(function()
playername = script.Parent.Parent.Parent.Parent.Name
playerteam = script.Parent.Parent.Parent.Parent
player = Workspace:FindFirstChild(""..playername.."")
if player ~= nil then
    player:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=267460168" 
    player:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=267460509"
end
end)

If anyone can tell me how to change this into a Server-Sided script, that would be great!

Cheers,

Michael

0
You just turned it into a server script, in case you didn't realize. As i suppose you had problems with LocalPlayer, put repeat wait() until game.Players.LocalPlayer above everything, and repeat wait() until game.Players.LocalPlayer.Character if you want to refer to that inside the script too. Otherwise you have already made your LocalScript able to become a server script. Anyway, i shall answer.. Marios2 360 — 9y

1 answer

Log in to vote
0
Answered by
Marios2 360 Moderation Voter
9 years ago

What you mean to ask is "How would all players see clothing if it changes with a script?"

One way you can do that is to obtain the Shirt and Pants you want, put them inside ServerStorage and call them again using LoadCharacterAppearance. Here's an example:

game.Players.PlayerAdded:connect(function(player)
    if player.Name == "Michael007800" then
        player.CharacterAdded:connect(function(char)
            char:WaitForChild("Shirt"):Destroy()
            char:WaitForChild("Pants"):Destroy() --If your shirt and pants don't get named "Shirt" and "Pants" just change those two names.
            player:LoadCharacterAppearance(game.ServerStorage.Shirt)
            player:LoadCharacterAppearance(game.ServerStorage.Pants)
        end
    end
end)

You don't need to parent your clothing, as LoadCharacterAppearance takes care for that.

Hope i helped!

Ad

Answer this question