Hey developers,
I am stressing it out how the script doesn’t work, however the output or console doesn’t show the error!
local MarketplaceService = game:GetService("MarketplaceService")
local ID = 10614376
script.Parent.MouseButton1Click:Connect(function()
if true then
wait(0.5)
script.Parent.GetRank.Text = "LOADING."
wait(0.5)
script.Parent.GetRank.Text = "LOADING.."
wait(0.5)
script.Parent.GetRank.Text = "LOADING..."
wait(0.5)
end
wait(2)
if true then
wait(0.5)
script.Parent.GetRank.Text = "CHECKING."
wait(0.5)
script.Parent.GetRank.Text = "CHECKING.."
wait(0.5)
script.Parent.GetRank.Text = "CHECKING..."
wait(0.5)
end
wait(5)
game.Players.PlayerAdded:Connect(function(player)
if game:GetService("GamePassService"):PlayerHasPass(player, ID) then
script.Parent.GetRank.Text = "YOUR RANK HAS BEEN UPDATED!"
game.ReplicatedStorage.GetRank2:FireServer()
wait(3)
game:GetService("TeleportService"):Teleport(5302266534)
else
script.Parent.GetRank.Text = "LOOK LIKE YOU DO NOT OWN THE GAMEPASS!"
wait(3)
game.Players.LocalPlayer:Kick("You do not own the gamepass! Come back when you purchase it!")
end
end)
end)
For the ServerScriptService:
local GlitchURL = "censored" --Place the glitch project URL inside of the quotes
function rankUser(UserId, RoleId)
game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
local MarketplaceService = game:GetService("MarketplaceService")
local Configuration = {
{10614388, 5},
}
game.ReplicatedStorage.GetRank.OnServerEvent:Connect(function(Player)
for i = 1, #Configuration do
local GamepassId = Configuration[i][1]
local RankId = Configuration[i][2]
if MarketplaceService:UserOwnsGamePassAsync(Player.UserId, GamepassId) then
print("Ranked player to " .. RankId)
rankUser(Player.UserId, RankId)
else
print("Player do not own the gamepass")
end
end
end)
I also have RemoteEvents in the Replicated Storage, everything seems to be perfect. But When I test it, nothing happen.
Any help is appreciated!