[SOLVED] GamePass Button Issues

I have this script:

if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, Gamepass_Id) then
	text.Text = "Rank"
else
	text.Text = "Buy"
end

I own the game pass, and the text isn’t turning into “Rank”.

Add print statements.

1 Like

I added the print statements, and in the output nothing showed up.
I got this error: "ReqRank is not a valid member of Folder “ReplicatedStorage.Requests”, and I don’t even have a requests folder.

Show me all of your code.

Now I am getting this: “ReqRank is not a valid member of RemoteEvent ReplicatedStorage.ReqRank”

Show me all of the code.

1 Like

The error is gone, but now I am still having the same issue. I am trying to make a custom rank center. The code is:

local button = script.Parent 
local count = 0 
local threshHold = 2 
local clickTime = 0.5 
local Gamepass_Id = 227600442
local rank_id = 205
local rank_name = "Trainee"
script.Parent.Parent.RankName.Text = rank_name
local MarketPlaceService = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
local text = script.Parent.BtnText
local text2 = script.Parent.Parent.Parent.Parent.Parent.Main.TextLabel
local ReplicatedStorage = game.ReplicatedStorage
local HttpService = game:GetService("HttpService")
local ReqRank = ReplicatedStorage.ReqRank
local groupId = 7536673

if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, Gamepass_Id) then
	script.Parent.BtnText.Text = "Rank"
print("owns gamepass")	
else
	script.Parent.BtnText.Text = "Buy"
print("doesnt own gamepass")	
end

function Click()


	if count % threshHold == 0 then
		if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, Gamepass_Id) then
		game.ReplicatedStorage.ReqRank:FireServer(Gamepass_Id, rank_id)
			local randomtext1 = "Ranking..."
			for i=1 , #randomtext1 do
				text2.Text = string.sub(randomtext1,1,i)
				wait(0.05)   -- detemines how slow text should be typed
			end
		end
	end
end
button.MouseButton1Click:Connect(Click)
button.TouchTap:Connect(Click) 

I tried again, and i got the “Owns gamepass” print which is good, but it still isn’t ranking and the text is rank, so that is also good.

I can DM you the ServerScriptService script which has the RankGun API in it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.