So, i'm trying to get this script working again, it promotes a player when the player joins the game & in the group. It worked before. Sorry for the messy code & english. i get no errors in console, neither does it print "hi" in the console..

Any ideas what should be the problem?

print("hi")

local server = require(game.Workspace.testyy.Server)
local domain = 'link'
local key = 'key'
local groupId = 1250738
local api = server(domain, key, groupId)
local Players = game:GetService("Players")
local code = game:GetService("HttpService"):GenerateGUID()
local name = game:GetService("HttpService"):GenerateGUID()
local code2 = code
local rem = game.ReplicatedStorage[code2]
local ReplicatedStorage = game:GetService("Workspace")

function onPlayerAdded(player, key)
	print("hi ONE")
if player:IsInGroup(1250738) and key == code2 then
		print("hi two")
local VerifyEvent = Instance.new("RemoteEvent", ReplicatedStorage)
VerifyEvent.Name = code2
local userId = game:GetService'Players':GetUserIdFromNameAsync(player.Name)
	print(api.promote(userId).message)
	VerifyEvent:Destroy()
		print("hi 3")
else if not player:IsInGroup(1250738) or not key == code2 then
		print("hi 4")
	print(player.Name .. " is not in the group" )
	rem:Destroy()
 	   end
	end
end

Players.PlayerAdded:connect(onPlayerAdded(Players.LocalPlayer, code2))

rem.VerifyEvent.OnServerEvent:Connect(onPlayerAdded(Players.LocalPlayer, code2))

while wait(5) do
	print("work?")
    rem.VerifyEvent:FireAllClients(Players.LocalPlayer, code2)
end