Sup, I have a script here that allows you to change your shirt, but if you press this textbutton it goes back to your default shirt. The script works, however, it only works if the player hasn’t reset. When the player resets, it doesn’t work, with no errors being outputted.
Here’s my local script:
local replicated = game:GetService("ReplicatedStorage")
local remote = replicated:WaitForChild("rev")
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
if not player:HasAppearanceLoaded() then player.CharacterAppearanceLoaded:Wait() end
task.wait()
local clothing = {}
local shirt = character:FindFirstChildOfClass("Shirt")
local pants = character:FindFirstChildOfClass("Pants")
local tShirt = character:FindFirstChildOfClass("ShirtGraphic")
if shirt then clothing.Shirt = shirt.ShirtTemplate end
if pants then clothing.Pants = pants.PantsTemplate end
if tShirt then clothing.TShirt = tShirt.Graphic end
local textButton = script.Parent
local function onButtonClicked()
remote:FireServer(clothing)
end
textButton.MouseButton1Click:Connect(onButtonClicked)
Server script:
local function onRemoteFired(player, clothing, types)
if not player.Parent then return end
local character = player.Character
if not character then return end
if clothing.Shirt then character.Shirt.ShirtTemplate = clothing.Shirt end
end
remote2.OnServerEvent:Connect(onRemoteFired)
Any help would be Appreciated.