Hello, I am a fairly new scripter here on the platform. I am making a script where when a division HR or main group HR joins the game it sends an alert on discord. My problem is the script only works in the studio play feature. And ideas why it might not be working? The script is below.
local url = "***This is where my webhook goes, removed for obvious reasons.***"
local http = game:GetService("HttpService")
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(6032406) >= 64 then
local data = {
['embeds'] = {{
['title'] = "GATR VIP Join",
['description'] = player.Name .. " has joined the game, go protect them!"
}}
}
local finaldata = http:JSONEncode(data)
http:PostAsync(url, finaldata)
elseif player:GetRankInGroup(6170760) >= 50 then
local data = {
['embeds'] = {{
['title'] = "RG VIP Join",
['description'] = player.Name .. " has joined the game, go protect them!"
}}
}
local finaldata = http:JSONEncode(data)
http:PostAsync(url, finaldata)
end
end)