I tested gamepass on local server, but its not working. game pass will give tycoon player 2 times more money. whenever i tested it myself, it works because i own the gamepass, but whenever i tried on local server its broken, thus purchase is failing.
can anyone help me out?
buying script (not local script)
local id = 214145059
local players = game:GetService("Players")
script.Parent.ButtonPart.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local player = players:GetPlayerFromCharacter(part.Parent)
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
end
end)
conveyer selling part code
local tycoon = script.Parent.Parent.Parent.Parent
local id1 = 214145059
local marketplace = game:GetService("MarketplaceService")
function func()
local success, result = pcall(function()
return marketplace:UserOwnsGamePassAsync(tycoon:GetAttribute("UserID"), id1)
end)
if success and result then
return true
else
return false
end
end
script.Parent.Touched:Connect(function(Hit)
if Hit.Name == "Part" and Hit:FindFirstChild("CashValue") then
local value = Hit:FindFirstChild("CashValue").Value
Hit:Destroy()
if func() then
value = 2 * value
end
tycoon:SetAttribute("CollectedCash", tycoon:GetAttribute("CollectedCash") + value)
end
end)