This is the script I've been trying:
local service = game:GetService("GamePassService")
local id = script.Parent.Parent.Parent.TextBox.Text
script.Parent.MouseButton1Click:Connect(function(player)
if service:PlayerHasPass(8343910)then
local sound = Instance.new("Sound")
sound.Name = "Music"
sound.SoundId = "rbxassetid://"..id
sound.Parent = game.Workspace
sound:play()
else
local mps = game:GetService("MarketplaceService")
mps:PromptGamePassPurchase(8343910)
end
end)
