Ok so I’m trying to make a gamepass, and if you buy it, a part will go transparent. It doesn’t work, and there are no errors in script analysis or output. Also this is a child of the part, and a local script. Please call out any errors I made and have a great day!
local MPS = game:GetService("MarketplaceService")
local BindableEvent = game.ServerStorage.Event
local GamepassID = 10169496
script.Parent.Touched:Connect(function()
MPS.PromptGamePassPurchaseFinished:Connect(function(Player, Id, Purchased)
if Id == GamepassID and Purchased then
script.Parent.Transparency = 1
print("yay!")
else
print("Get noob!")
end
end)
end)
local MPS = game:GetService("MarketplaceService")
local BindableEvent = game.ServerStorage.Event
local GamepassID = 10169496
MPS.PromptGamePassPurchaseFinished:Connect(function(Player, Id, Purchased)
if Id == GamepassID and Purchased then
script.Parent.Transparency = 1
print("yay!")
else
print("Get noob!")
end
end)
If you wanna to check if player have gamepass use this
local MPS = game:GetService("MarketplaceService")
local BindableEvent = game.ServerStorage.Event
local GamepassID = 10169496
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if MPS:UserOwnsGamePassAsync(plr.UserId,GamepassID) then
-- do stuff
end
end
end)
local MPS = game:GetService("MarketplaceService")
--local BindableEvent = game.ServerStorage.Event -- You can remove -- if you want :P
local GamepassID = --Change to your pass id
script.Parent.Touched:Connect(function(hit)
print(hit.Parent.Name)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if MPS:UserOwnsGamePassAsync(plr.UserId,GamepassID) then
print("ihavepass") -- remove this if you want
-- do stuff
end
end
end)