You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am trying to make a game detect if a player is the owner of a group game. I am selling this hence why I cant hard code it.
- What is the issue? Include screenshots / videos if possible!
I can run the program just fine but it doesnt run any of the event. I even put a print statement after the chatted event but it prints nothing even after the if statements.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I got the idea from this dev forum post API to check if user is owner from game (or group owner)? and it looks basically like mine but cant seem to find the issue.
Program Code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlaceInfo = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId)
script:WaitForChild("AdminCommand").Parent = ReplicatedStorage
script:WaitForChild("OpenUI").Parent = ReplicatedStorage
local DataSaving = require(script:WaitForChild("DataSaving"))
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
local message = string.lower(msg)
if message == ":adminpanel" then
if PlaceInfo.Creator.CreatorType == Enum.CreatorType.Group then
print("group game")
local GameOwner = game:GetService("GroupService"):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Id
if GameOwner == player.UserId or DataSaving:GetData(player, "IsAdmin") then
ReplicatedStorage.OpenUI:FireServer()
else
print "not creator"
end
else
print("not a group game")
if player.UserId == game.CreatorId or DataSaving:GetData(player, "IsAdmin") then
ReplicatedStorage.OpenUI:FireServer()
else
print "not creator"
end
end
else
print("message not found")
end
end)
end)