What do you want to achieve?
Local Players Shirt is a certain ShirtId(Note: This script is a server script)
What is the issue?
“WaitForChild” runs infinitely, Even when removed, Char.Shirt is non existent. And the print statement fires btw.
game:GetService("Players").PlayerAdded:Connect(function(plr)
print("player added")
plr.CharacterAdded:Connect(function(char)
repeat wait() until char.Shirt and char.Pants
print("shirt loaded")
local shirtchar= char:WaitForChild("Shirt")
local pantschar= char:WaitForChild("Pants")
shirtchar=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Shirt.ShirtTemplate
pantschar=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Pants.PantsTemplate
end)
end)
How would I be able to acess the characters shirt?
Can’t see the main issue, but the later part of your code is flawed.
local pantschar= char:WaitForChild("Pants")
shirtchar=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Shirt.ShirtTemplate
pantschar=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Pants.PantsTemplate
All you are achieving is redefining shirtchar
and pantschar
to the template - it is not changing the player’s shirt / pants at all
Fixed it, I changed the shirt by accessing plr.Character and changing the .ShirtTemplate aswell
local playerShirt=plr.Character:FindFirstChildWhichIsA("Shirt")
local playerPants= plr.Character:FindFirstChildWhichIsA("Pants")
playerShirt.ShirtTemplate=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Shirt.ShirtTemplate
playerPants.PantsTemplate=game.ReplicatedStorage.Avatar["Class Outfits"].Citizen.Pants.PantsTemplate
system
(system)
Closed
January 28, 2023, 12:21am
#4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.