I was making a VIP overhead gui but I didn’t work
I tried following AlvinBlox’s YT video but it didn’t work
I checked for mistakes from the script but there are no mistakes
I also made another gamepass just incase still doesn’t work
script:
local tag = game:GetService("ServerStorage"):WaitForChild("VipTag") -- vip tag
local memtag = game:GetService("ServerStorage"):WaitForChild("AgorpMember") -- group member tag
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr, 21671832) then
local clone = tag:Clone()
clone.Parent = game.Workspace:WaitForChild(plr.Name).Head
elseif plr:IsInGroup(9989970) then
local clone1 = memtag:Clone()
clone1.Parent = game.Workspace:WaitForChild(plr.Name).Head
end
end)
end)
I did everything you told
I checked if the gui is disabled [it’s enabled]
I checked if got the wrong gamepass [it’s the right gamepass and also it’s on sale]
Okay, so I looked up the the ID of the gamepass and it wasn’t a gamepass. It was a decal image.
Nevermind it was a valid gamepass, but I don’t think you own it.
and NEVERMIND that because I just saw the new image
I’m a bit confused, try this (I only added a print, check them in the Output)
local tag = game:GetService("ServerStorage"):WaitForChild("VipTag") -- vip tag
local memtag = game:GetService("ServerStorage"):WaitForChild("AgorpMember") -- group member tag
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 21671832) then
print("gamepass owned")
local clone = tag:Clone()
clone.Parent = game.Workspace:WaitForChild(plr.Name).Head
elseif plr:IsInGroup(9989970) then
local clone1 = memtag:Clone()
clone1.Parent = game.Workspace:WaitForChild(plr.Name).Head
end
end)
end)
Sorry to butt in, but I believe the problem is because you’re purchasing it mid game. Your script checks when the first character is added and then that result gets cached on Roblox so that the server can access it faster instead of making a call every time.
And the easy solution would be to store if a player purchased it in that server, and if they did, to then give it to them.
local bought = {} --Empty table
local tag = game:GetService("ServerStorage"):WaitForChild("VipTag") -- vip tag
local memtag = game:GetService("ServerStorage"):WaitForChild("AgorpMember") -- group member tag
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId, 21671832) or bought[player.UserId] then --Check if they own the gamepass, or if they bought it in this server.
local clone = tag:Clone()
clone.Parent = char.Head
elseif plr:IsInGroup(9989970) then
local clone1 = memtag:Clone()
clone1.Parent = char.Head
end
end)
end)
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, purchased)
if gamepassId == 21671832 then --Check that it's the vip gamepass
bought[player.UserId] = purchased --Add into the table to show whether it was purchased or not (a boolean value) so we can check when the character is added.
--Add your code from above down here to add the tag if you want it to give it to them right away vs waiting for them to respawn.
end
end)
If you use the code I provided, it will work in both!
The problem (should) just be that you aren’t storing that the player purchased it, and instead are just using the cached Roblox API result saying that they don’t own it. So even when they purchase it mid game, it will still show that they don’t own it.
@DumbHeadEdison Yes, it’s because he doesn’t have it when he joins, but in the pictures he sent, he was trying to purchase it mid game and it wasn’t giving it to him.