so this is the script
local player script.Parent.MouseButton1Click:Connect(function() local MarketplaceService = game:GetService("MarketplaceService") local productID = 993976756 player = script.Parent.Parent.Parent.Parent.Parent.Name print(player) MarketplaceService:PromptProductPurchase(player,productID) end)
when i run it, it says, unable to cast value to object it happens at the
MarketplaceService:PromptProductPurchase(player,productID)
So you are giving the MarketPlaceService:PromptProductPurchase a string value of the players name. Instead you should be passing it the actual player.
So in a local script you know how you would say local player = game.Players.LocalPlayer.
You would use the player instead of the players name.
I'm not sure where this script is but if you put the actual player instead of the name you should be good.
If you remove .Name It should solve your issue. If that is indeed the player.