These are the scripts I already have but I need it to make it so when you aren't in the group and you click the hat it will pop up a gui saying "You need to join this group to equip this!" I have that covered but when people are joined I want people able to click the hat and it will equip with no problem.

local groupId = 5739908
 
function onPlayerSpawned(player) -- The function to fire
    if player:IsInGroup(groupId) then -- If they are in this group then
game.ServerStorage.hat:Clone().Parent = game.Workspace[player.Name]    -- Clone the hat into their character
end
game.Players.PlayerAdded:connect(function(player) -- When a player joins
  player.CharacterAdded:connect(function() -- When their character is added
    onPlayerSpawned(player) -- Fire the function
  end)
end)

I marked all the details to this script

This is other script making the hat

ClickDetector.MouseClick:Connect(function(player)
if player:IsInGroup(5739908) then
game.ServerStorage.hat:Clone().Parent = game.Workspace[player.Name]
end
end)

3 comments

0

you need to make the gui and add an else statement and when the else runs you need to clone the gui into the playergui

0

So where would I put the hat, and the hat giver?

0

Bro I told you on discord a million times. SERIOUSLY?