Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I want the player's clothes to be changed through a Remote Event, But it Dont work?

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.

2 answers

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

2 comments

0
0

are the folder's names " "? with a space

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!

2 comments

0

it doesnt work

0

errors?

This discussion is preserved as it was. New answers, comments, and votes are closed.