Hi, I want the player's clothes to be changed through a Remote Event, so I can enable the FE in my game. But it doesn't work, it doesn't give error or warnings or anything, it just doesn't work. Look at my scripts:
Local script
local PantsId = script.Parent.Parent:FindFirstChild("").Pants.PantsTemplate local ShirtId = script.Parent.Parent:FindFirstChild("").Shirt.ShirtTemplate script.Parent.Bottom.ClickDetector.MouseClick:connect(function(player) game.ReplicatedStorage.Changer:FireServer(PantsId, "p") end) script.Parent.Top.ClickDetector.MouseClick:connect(function(player) game.ReplicatedStorage.Changer:FireServer(ShirtId, "s") end)
Server script
game.ReplicatedStorage.Changer.OnServerEvent:Connect(function(p,Id, PS) if PS == "p" then p.Character.Pants.PantsTemplate = Id elseif PS == "s" then p.Character.Shirt.ShirtTemplate = Id end end)
If there is another simpler way to change the player's clothes and everyone else can see with the FE enabled, please tell me.
I'm guessing your trying to get pants and shirts on the first lines but you didn't put it in FindFirstChild("")
so when you called that function, it returned nil probably
try this
local PantsId = script.Parent.Parent:FindFirstChild("Pants").Template local ShirtId = script.Parent.Parent:FindFirstChild("Shirt").Template
Assuming from your screenshot, it's because they're name isn't blank, it has a space
" "
local PantsId = script.Parent.Parent:FindFirstChild(" ").Pants.PantsTemplate local ShirtId = script.Parent.Parent:FindFirstChild(" ").Shirt.ShirtTemplate script.Parent.Bottom.ClickDetector.MouseClick:connect(function(player) game.ReplicatedStorage.Changer:FireServer(PantsId, "p") end) script.Parent.Top.ClickDetector.MouseClick:connect(function(player) game.ReplicatedStorage.Changer:FireServer(ShirtId, "s") end)
Should Work!