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

Why doesn't the part accept it with the owned asset and why does it work once?

Asked by
yoshi8080 445 Moderation Voter
8 years ago

I made this VIP cash giver, however I have made the asset and I can't claim it. As it shows me not having it the loop won't work?

local touch = false
MPS = game:GetService("MarketplaceService")
id = 338348248
function onTouched(hit)

    if touch == false then 
    touch = true 
    check = hit.Parent:FindFirstChild("Humanoid")

    if check ~= nil then 

local user = game.Players:GetPlayerFromCharacter(hit.Parent) 
local stats = user:findFirstChild("leaderstats")
local text = script.Parent.NameGUI.Text
local sound = script.Parent.Song.Sound
local error = script.Parent.Song.Error
local cash = stats:findFirstChild("Cents") 

if stats ~= nil then
            text.Text = 'Does not have VIP'
            error:Play()
            wait(2)
            text.Text = 'Collect VIP Cents'
elseif stats ~= nil and MPS:PlayerOwnsAsset(user, id) then 
            cash.Value  = cash.Value + 150
            text.Text = 'Cents Collected by: '..user.Name
            sound:Play()
            wait(5)
            text.Text = 'Collect VIP Cents'
        end
            end
                end
                    end
    touch = false


script.Parent.Touched:connect(onTouched)

No errors

Answer this question