Okay listen try the script i posted edit it so it works for your game and tell me if it works.
Why would you want to put them out seperately with alot of players that would cause a massive mess also i think your overcomplicating it for him/her.
I created a game which was having the same problems as this topic’s, and I tried to tell my solution.
There was an error: " Shirt is not a valid member of Model “Deathlios” "
it is with this line local OriginalShirt = Character.Shirt.ShirtTemplate
That means the shirt hasn’t loaded in yet. So use WaitForChild.
game:GetService("Players").PlayerAdded:Connect(function(Player)
local newFolder = Instance.new("Folder")
newFolder.Name = "DefaultClothing"
newFolder.Parent = Player
local Shirt = Instance.new("Shirt")
local Pants = Instance.new("Pants")
Shirt.Parent = newFolder
Pants.Parent = newFolder
Player.CharacterAdded:Connect(function(Character)
Shirt.ShirtTemplate = Character:WaitForChild("Shirt").ShirtTemplate
Pants.PantsTemplate = Character:WaitForChild("Pants").PantsTemplate
end)
end)
SuitUp.OnServerEvent:Connect(function(Player)
local SuitParts = Player.DefaultClothing
local Top = SuitParts.Top
local Bottom = SuitParts.Bottom
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Player.Character:FindFirstChild("Humanoid")
local OriginalShirt = Character:WaitForChild("Shirt").ShirtTemplate
local OriginalPants = Character:WaitForChild("Pants").PantsTemplate
for _,v in pairs(Character:GetChildren()) do
if v:IsA("Accessory") and not v.Handle:FindFirstChild("HairAttachment")then
v.Handle.Transparency = 1
end
end
OriginalShirt = "ShirtTemplate"
OriginalPants = "PantsTemplate"
end)
Wait what exactly have you done with the script? Or rather what’s it meant to do? Because nothing noticeable has changed.
I replaced .Shirt and .Pants with :WaitForChild(“Shirt”) and :WaitForChild(“Pants”)
[quote=“112365595, post:45, topic:991127”]
local OriginalShirt = Character:WaitForChild("Shirt").ShirtTemplate
local OriginalPants = Character:WaitForChild("Pants").PantsTemplate
[/quote] This is what it changed, right?
I meant what is your revision of the script supposed to do? Does it allow the script to remember the original clothing?
Yeah it does because it stores the original clothing ids inside of a folder inside of the player when they join.
Maybe you accidentally swapped between shirt and pants links, trying swapping these, then try them with rbxassetid://ID
if that doesn’t work.
I did told him that. It didn’t worked.
Well if you goto the shirt id then it leads you to a shirt so i don’t think so.
What is this new addition supposed to do? What’s the difference between this and my original script in terms of functionality?
WaitForChild() is a yield function (i think) that waits for the asset to load.
It stores the old shirt and pants templates which is what you asked for also can you test it?
I tried it, but since I can’t change to a different template, i can’t see whether it works or not.
Not only that I want the templates remembered in a different function which is the suit down function.This is the function that I want the player to change clothing:
SuitUp.OnServerEvent:Connect(function(Player)
local SuitParts = Player.DefaultClothing
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Player.Character:FindFirstChild("Humanoid")
local OriginalShirt = Character.Shirt.ShirtTemplate
local OriginalPants = Character.Pants.PantsTemplate
for _,v in pairs(Character:GetChildren()) do
if v:IsA("Accessory") and not v.Handle:FindFirstChild("HairAttachment")then
v.Handle.Transparency = 1
end
end
OriginalShirt = "ShirtTemplate"
OriginalPants = "PantsTemplate"
end)
And this next function:
SuitDown.OnServerEvent:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait()
for _,v in pairs(Character:GetChildren()) do
if v:IsA("Accessory")then
v.Handle.Transparency =0
end
end
end)
This is where I want the script to remember the original templates, but in your original script the original templates is only local to the suit up function hence I won’t be able to acess in this other function.
Its not changing the template because you didn’t get the shirt template which is “rbxassetid://3282533899” you most likely set the shirt id as the template which doesn’t work. For the suit down it should be self explanitory you just set the shirts and pants template to the shirt and pants templates in the folder.
Ah okay, i see what you’re doing now. Can I ask what is the point of
local OriginalShirt = Character.Shirt.ShirtTemplate
local OriginalPants = Character.Pants.PantsTemplate
and
OriginalShirt = "ShirtTemplate"
OriginalPants = "PantsTemplate"
??