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?
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)
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.
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