get sum from roblox studio to get hat models then make ur own folder
I hate to say this but it doesnât work, this isnât really a big thing for my project so Iâll just mark this as solved because I feel as if this is impossible to achieve.
no no no no just explain the issue.
Check mine pls Iâd like to see if it works for u
Everything is possible! Even from our imagination.
So what issue is it?
- Hats are still duplicates on characters?
- Player has multiple hats?
- Any errors?
Okay, here is an image just now using the script you made
I donât want the players to have a mess of hats, I just want them to have one hat, also options 1 and 2, there are no errors, so we donât need to worry about that.
local Hats = game:GetService(âReplicatedStorageâ):FindFirstChild(âCharacterAssetsâ):FindFirstChild(âHatsâ):GetChildren()
game.Players.PlayerAdded:Connect(function(Player)
if Player then
local Character = Player.Character or Player.CharacterAdded:Wait()
local randomHat = math.random(1,#Hats)
local Chosen = Hats[randomHat]:Clone()
Chosen.Parent = Character:FindFirstChild('Head')
end
end)
The issue in your script is that you donât delete it from server storage etc. You are duplicating the item.
Looks to me like youâre setting the hat for the StarterCharacter model instead of each playerâs character. You could try to set the playerâs characterâs hats when they spawn in like this
local ServerStorage = game:GetService("ServerStorage")
game:GetService("Players").PlayerAdded:Connect(function(player)
if player.Character then
local Hats = ServerStorage.CharacterAssets:WaitForChild("Hats"):GetChildren()
local Hat = Hats[math.random(1, #Hats)]
Hat.Parent = player.Character
end
player.CharacterAdded:Connect(function(char)
local Hats = ServerStorage.CharacterAssets:WaitForChild("Hats"):GetChildren()
local Hat = Hats[math.random(1, #Hats)]
Hat.Parent = char
end)
end)
Luck canât be decided itâd be best to clone it so others can have that hat
Yeah this one works exactly how Iâd imagine it to work, thank you so much, and Iâm very sorry for wasting everyones time on this.
But he didnât even want to others have the same hatâŚ
Nah it was nice to to break my head a bit. I think i got my code like 10 seconds later oh well
Youâre welcome. Glad I could help!
âit doesnât matter if two players have the same hatâ
first read the full post before trying to correct him thanks.
Iâm get how I sound here but Iâd imagine stating it as the quote says would be the most reliable source on what he wantâs as itâs the most recent
Iâm not here to argue