This is a simple fix. @MinecraftCamo mentioned this already. Your shirt appears when you create it in the LocalScript, but keep in mind that you created it… locally. So, on the server side of things, you have no shirt. Which is exactly what we have here. Easy fix to all this is to reset and create a new shirt on the server side of things.
I don’t have any accessories or attachments that the script would remove the first time I run the script or the second time, if I have hit the resetshirt screengui. If I keep just changing my shirt, w/out trying to reset just my shirt, it will change the layered shirts correctly. Until I hit the reset shirtbutton
Ok, I will do that now. THank you!
It looks like you’re working a bit deeply with the clothing here. For something like this over all I would use a deeper way than just deleting and inserting items.
You’ll have to re-write these to your needs… these are just some basic scripts to consider.
Remove all accessories (2024 version)
--> SeverScript @ServerScriptService
rs=game:GetService("RunService")
local pls=game:GetService("Players")
pls.PlayerAdded:Connect(function(plr)
plr.characterAdded:Connect(function(chr)
repeat rs.Stepped:Wait()until(plr.Character.Humanoid)
for _,a in pairs(chr.Humanoid:GetAccessories())do
if a.AccessoryType~=Enum.AccessoryType.Hair and
a.AccessoryType~=Enum.AccessoryType.Eyelash and
a.AccessoryType~=Enum.AccessoryType.Eyebrow then
a:Destroy()
end
end
end)
end)
A remote triggered change (pants and shirt)
using Humanoid Description.
--> SeverScript @ServerScriptService
local des,dfp,dfs,pid,pas
local pls=game:GetService("Players")
local rs=game:GetService("RunService")
local remote=game:GetService("ReplicatedStorage")
:WaitForChild("ApplyOutfitRemote") -- create this
dfp,dfs=4637601297,4637596615
local function applyOutfit(plr)pid=plr.UserId
pas,_ =pcall(function()task.wait(0.3)
des = pls:GetHumanoidDescriptionFromUserId(pid)
end) if not pas then warn("Outfit loading error")return end
des.Pants=dfp des.Shirt=dfs rs.Stepped:Wait()
plr.Character.Humanoid:ApplyDescription(des)
end
remote.OnServerEvent:Connect(function(plr)
applyOutfit(plr)
end)
Inside a gui button (fire remote)
--> LocalScript @StarterGui/Gui/Button
local button = script.Parent
local remote = game:GetService("ReplicatedStorage")
:WaitForChild("ApplyOutfitRemote")
button.MouseButton1Click:Connect(function()
remote:FireServer()
end)
so I added this to my serverscriptservice script
if Human and Human.Parent:FindFirstChild("Shirt") == nil then
local p = Instance.new("Shirt", Human.Parent) p.Name = "Shirt"
end
but it didn’t change anything. But nothing changed. How do I connect that to the shirtbutton button in my gui?
do you know how to use remote events? if so, use those, if not youtube a quick tutorial on it and apply it to this.
you can also see an example of remote events in the place file i attached earlier.
simply moving the code from the localscript to your existing server script wont work.
I have tried to connect to a remote and I never get it to work. I am literally on version 306 of one of the scripts.
But you all have helped me a lot. I know for sure I need to connect this to a remoteevent, so I will keep researching how to do it. Thank you!
I don’t know who to credit for the solution. BT7274 or bluedood as you both helped a lot! Maybe that should be a change to the system, voting more than 1 person
I’m glad I could help! You can credit either one of us, I don’t mind if you don’t credit me for the solution.
Just wanted to thank everyone who helped out on this. After creating the remote event (which I was afraid to try because the screengui is a dropdown menu…anyway) I finally got it to work properly!
Thanks again!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.