Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make it onplayertouch instead?

local passId = 7046842

script.Parent.ClickDetector.MouseClick:connect(function(player)
	Game:GetService("MarketplaceService"):PromptPurchase(player, passId)
end)

2 comments

0

I'm not sure what you mean... like when the character makes contact with the part?

0

You need to be more specific, I dont understand what you're asking for

1 answer

✓ Accepted answer
local passId = 7046842

function touch(hit)
	local player = hit.Parent
	local plr = game.Players:GetPlayerFromCharacter(player)
	if player:FindFirstChild("Humanoid") and plr then
		Game:GetService("MarketplaceService"):PromptPurchase(plr, passId)
	end
end

script.Parent.Touched:Connect(touch)

This discussion is preserved as it was. New answers, comments, and votes are closed.