Check if specific group owns place

Hey, I’ve been working on a product and now I want to make it so that this UI will only work if the owner of the place is the group [the buyer is a group]. How would I get around doing this?

Would I use placeinfo.creator.creatortype and if so, how could I identify what group?

Thank you!

Well first of all this post is in the wrong category, it should be in #help-and-feedback:scripting-support

You’d basically use :IsInGroup()

(From the documentation):

local Players = game:GetService("Players")
 
Players.PlayerAdded:Connect(function(player)
    if game.CreatorType == Enum.CreatorType.Group then
        if player:IsInGroup(game.CreatorId) then
            print("A member of the group that owns the place has joined the game!")
        end
    end
end)

oh sorry is there any way to change that?

but i want to check if the game is actually owned by the group

what i want to do, is check that the group owns the game. if it doesn’t then i want it to print something

so like,

does Something Studios own this game? if not, print something random

Use the Array CreatorId
(30charrrrrrrrrrrrrrrs)

would it be possible to use game.CreatorID and put in the group id?

so basically, you can use CreatorID and put the group’s id down??

wouldn’t that clash with a player’s id?

I have solved it: I shall show you the script I have used.

local group = game:GetService("GroupService"):GetGroupInfoAsync(groupId)

local owner = group.Owner
local ownerName = owner.Name
local ownerUID = owner.Id

print(group.Name .. "'s owner name is " .. ownerName .. " and his UserId is " .. ownerUID)


if game.CreatorType == Enum.CreatorType.Group then
	local group2 = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId)
	if group2.Name == "El Al." then
		print("this is allowed")
	else
		print("leaked?")
		for i, v in pairs(game.Workspace:GetDescendants()) do
			if v.Name == "gateScreen" then
				v:Destroy()
				for i, nothalal in pairs(game.ServerScriptService:GetDescendants()) do
					if nothalal.Name == "chattedScript" then
						nothalal:Destroy()
					elseif notHalal.Name == "remotesHandler" then
						nothalal:Destroy()
					end
				end
			end
		end
	end
else
	print("also maybe leaked")
	for i, v in pairs(game.Workspace:GetDescendants()) do
		if v.Name == "gateScreen" then
			v:Destroy()
			for i, nothalal in pairs(game.ServerScriptService:GetDescendants()) do
				nothalal:Destroy()
			end
		end
	end
end

And that is what I used. Basically I got the information of the desired group and then compared it with the actual current owner of the place. If it was not a group that owned the place, the product was destroyed. If the group names didn;t match up, it was destroyed.

– kyro

This works fine, however an easier way to do it with just the GroupID is this:

local groupId = 10169959 --Nediah
local group = game:GetService("GroupService"):GetGroupInfoAsync(groupId)


if group == 10169959 then
	print("Yes")
else
	game:GetService("Players").LocalPlayer:Kick("Do not steal assets.")
end

Hope this helped! ^^