game.ReplicatedStorage.GetDriver.OnServerEvent:Connect(function(player)
local mps = game:GetService('MarketplaceService')
mps:PromptGamePassPurchase(player.UserId, 7085552)
if mps:PromptGamePassPurchaseFinished(player.UserId, 7085552) or mps:UserOwnsGamePassAsync(player.UserId, 7085552) then
player.PlayerGui.CarGui.Frame.Visible = false
game.ReplicatedStorage["Police Car"]:Clone().Parent = workspace
else
end
end)
--Script in ServerScriptService
This is my script above. If some guy clicks a button, then it will use a RemoteEvent to make purchases(THIS IS A SERVER SCRIPT!!!) but in line 3 (mps:PromptGamePassPurchase(player.UserId, 7085552) we get Unable to cast value to object I checked if the sent info was right yes the userid was my user id(i'm the tester!) and the gamepass id is right but can anybody fix this error?

1 comment
oops i forgot i had to use connect function on line 4 but anyways no matter cause the line is on line 3 lol