I dont really know how to summarize my problem for a title so let me explain my problem here:
I have made a hat selection GUI and it works gret, but if you die or reset, you will not spawn with your hat. So you have to re-equip it every time you die. How can i make it so once you select a hat you wont have to re-equip it after you die?
Heres the script ive got:
local chooseHats = game.ReplicatedStorage:WaitForChild("ChooseHats")
local hatsFold = game.ReplicatedStorage:WaitForChild("Hats")
chooseHats.OnServerEvent:Connect(function(player,fullName)
local character = player.Character
if fullName == "None" then
for i,v in pairs(character:GetChildren()) do
if v:IsA("Accessory") or v:IsA("Hat") then
v:Destroy()
end
end
else
for i,v in pairs(character:GetChildren()) do
if v:IsA("Accessory") or v:IsA("Hat") then
v:Destroy()
end
end
local accessory = hatsFold:FindFirstChild(fullName)
if accessory ~= nil then
local cloneHat = accessory:Clone()
cloneHat.Parent = character
end
end
end)