Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make it onplayertouch instead?

Asked by
iHavoc101 127
5 years ago
local passId = 7046842

script.Parent.ClickDetector.MouseClick:connect(function(player)
    Game:GetService("MarketplaceService"):PromptPurchase(player, passId)
end)
0
I'm not sure what you mean... like when the character makes contact with the part? IceAndNull 142 — 5y
0
You need to be more specific, I dont understand what you're asking for XURN2950 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
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)
Ad

Answer this question