In ROBLOX, I have some people that work as admins in my game, but I want to give them certain hats, Kind of like a personal tools script. I have tried combining 2 scripts, but I am 99.9% sure that the backpack won't work with hats. Any help?
--------- works for me, try it! admins = { "Delude_d" } game.Players.PlayerAdded:Connect(function(p) p.CharacterAdded:Connect(function(c) for _,v in pairs (admins) do if p.Name == v then local rep = game:GetService("ReplicatedStorage") local hat = rep:WaitForChild("Hat"):Clone() hat.Parent = c end end end) end)
This seems pretty easy. First you will need to fire an event when the admins join in so. And a event for every time their player respawns. Then you get the names of the admins in a workspace:GetChildren parameter. Then get your stored hat(s) somewhere. I'm using game.Lighting to store the hat. So you then clone it and make the clone's parent the admin if they don't have the hat. If my script isn't perfect you should be able to fix some bits your self `~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char)
for i,v in pairs(workspace:GetChildren())do if v:FindFirstChild("Humanoid") and v.Name == "(Insert admin name)" or v.Name == "(Insert admin name)" and v:FindFirstChild("AdminHat") == nil then game.Lighting.AdminHat:Clone().Parent = v end end end end
~~~~~~~~~~~~~~~~~ Hopefully I helped. :) `