Not detecting player added?
I was creating a admin script and I kept having a problem were it wouldn't detect a player being added. I've sent prints through and it works until it checks for the player to be added which is confusing. This has worked for me before but not now.
01 | local Admin = require(script.DollorsAdmin) |
02 | script.DollorsAdmin.Parent = game.ReplicatedStorage |
09 | Admin.GetPrefix(Settings.Prefix) |
11 | if Admin.Loaded = = true then |
12 | print ( 'Admin Loaded!' ) |
14 | warn( 'Admin Could not load. Please rejoin the server.' ) |
18 | local PlaceId = game.PlaceId |
19 | local PlaceInfo = game:GetService( "MarketplaceService" ):GetProductInfo(PlaceId) |
21 | if PlaceInfo.Creator.CreatorType = = "Group" then |
22 | GameOwnerName = game:GetService( "GroupService" ):GetGroupInfoAsync(PlaceInfo.Creator.CreatorTargetId).Owner.Name |
23 | elseif PlaceInfo.Creator.CreatorType = = "User" then |
24 | GameOwnerName = PlaceInfo.Creator.Name |
29 | local OwnerID = game.Players:GetUserIdFromNameAsync(GameOwnerName) |
31 | table.insert(AdminIDs, #AdminIDs + 1 , OwnerID) |
33 | game.Players.PlayerAdded:Connect( function (plr) |
35 | for i, v in pairs (AdminIDs) do |
36 | if plr.UserId = = v then |
37 | plr.Chatted:Connect( function (msg) |
38 | if msg:sub( 1 , 1 ) = = Settings.Prefix then |
39 | Admin.SendCommand(msg) |
I don't understand why at the end at line 33 I get no error but it never printed the players name on add...