I want to make it so when you touch the part, and you have that specific role in your group, it will give you the hat. Error: Workspace.Part.Script:9: attempt to compare number and string
local hat = game.ServerStorage.or3
local groupid = 4911373
local door = script.Parent
door.Touched:connect(function(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
if plr then
if plr:IsInGroup(groupid) then
if plr:GetRoleInGroup(4911373) >= 100 then
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if not hit.Parent:FindFirstChild("hat") then
hat:Clone().Parent = hit.Parent
end
end
end)
end
end
end
end)

1 comment
Why do you have the 2 same touched events? Remove the event inside and I think it should be fixed.