I have this script which basically puts the hat on your head, I'm wondering if it's possible to make it put it on your head when the player spawns and if your able to do it so it gives it depending on rank?
local hat = script.Parent
hat.PrimaryPart = hat:WaitForChild("Head") normal Head.
function weldParts(part0, part1)
local newWeld = Instance.new("Weld")
newWeld.Part0 = part0
newWeld.Part1 = part1
newWeld.C0 = CFrame.new()
newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
newWeld.Parent = part0
end
hat.Head.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("Earl's Coronet")then else return end
for _, v in pairs (hit.Parent:GetChildren()) do
if v:IsA("Hat") then
v:Destroy()
end
end
local head = hit.Parent:FindFirstChild("Head")
local newHat = hat:Clone()
newHat:FindFirstChild("HatScript"):Destroy()
newHat:SetPrimaryPartCFrame(head.CFrame)
newHat.PrimaryPart:Destroy()
for _, part in pairs (newHat:GetChildren()) do
if part:IsA("BasePart") then
weldParts(head, part)
part.CanCollide = false
part.Anchored = false
end
end
newHat.Parent = hit.Parent
end)

9 comments
What If I want to do it with multiple hats?
It would be the same thing.
And can it be done if your a certain rank in the group?
Yea i'll edit the script for you
k edited
Just replace "PUTRANKNUMBERHERE" with the number of the rank when you go into your groups settings
If you dont know what i mean by the group rank number then go to your group and click group admin and click rolls and it would be under Rank(0-255) and that is the number
Do I place the second script inside the model
Doesn't seem to be working