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

What is wrong with this script?

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

This script was named shop. When one of my friend bought the 10 PP for 10 tix, he didn't get any. What is wrong with this script? I saw this in Youtube the site for me to buy this model and this is what I had so far:

local plr = script.Parent.Parent.Parent local link = game:GetService("MarketplaceService") local y = 75 -- 300( the frame's Y Size offset) /# of buttons you want. -> 300/4 = 75 local statn = "KOs" -- stat name here

local function create(instanc) return function(object) local button = Instance.new(instanc) for i,v in pairs(object) do button[i] = v end return button end end

------For testing, comment this out when you're going online.

repeat wait() until plr:findFirstChild("leaderstats") local stat = plr.leaderstats[statn]

--[[

*Your info in conversion. 
    *You can't use my ID's in your place, you will get a maintenance error.

    -id = Your dev product id.
    -points = How much will be rewarded upon purchase. [ LEAVE IT TO 0 ]
    -cost = Shows how much it will cost on the GUI
    -nam = Desc of product on the GUI
    - You can also put more of the id = stuff to add more developer products. Copy and paste it again.

--]]

local conversions = { {id = 20872797, points = 0, cost = 10, nam = "Add 30 Player Points!"}; {id = 20872797, points = 0, cost = 10, nam = "Add 60 Player Points AND heal yourself!"}; {id = 20872797, points = 0, cost = 10, nam = "Add 90 Player Points AND Insta-Illumina!"};

}

local main = create("Frame") { Size = UDim2.new(0, 250, 0, 0); BackgroundTransparency = 1; ZIndex = 3; Position = UDim2.new(0,-250,.5,-165); Name = "Shop"; Parent = script.Parent }

local folder = create("Frame") { Size = UDim2.new(0,200,0,300); BackgroundColor = BrickColor.new("Really black"); BackgroundTransparency = .3; Active = true; ZIndex = 2; Parent = main

}

local header = create("Frame") { Size = UDim2.new(.5,0,0,20); Position = UDim2.new(1,0,0,0); Name = "ShopHeader"; BackgroundTransparency = 1; ZIndex = 3; Parent = main }

local Tbutton = create("TextButton") { Size = UDim2.new(0,20,0,20); Position = UDim2.new(1,3,0,0); BackgroundTransparency = .25; BackgroundColor = BrickColor.new("Really black"); ZIndex = 3; BorderSizePixel = 0; Text = ">>"; TextColor = BrickColor.White(); Parent = header

}

local label = create("TextLabel") { Text = "Shop"; Size = UDim2.new(1,0,0,20); BackgroundTransparency = .25; BackgroundColor = BrickColor.new("Really black"); ZIndex = 3; BorderSizePixel = 0; TextColor = BrickColor.White(); Font = "Legacy"; FontSize = "Size12"; Parent = header

}

local watermark = create("TextLabel") { Size = UDim2.new(0,0,0,0); Position = UDim2.new(1,0,1,0); TextXAlignment = "Right"; TextYAlignment = "Bottom"; BackgroundTransparency = 1; ZIndex = 3; TextColor = BrickColor.new("Institutional white"); Font = "Legacy"; FontSize = "Size10"; Text = "GUI by Azarth"; TextTransparency = .9; Parent = folder

}

local function buyItem(button) button.MouseButton1Click:connect(function() local marketId = button["market"].Value local pointsToAward = button["points"].Value link:PromptProductPurchase(plr,marketId) link.ProcessReceipt = function(receiptInfo) if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then stat.Value = stat.Value + pointsToAward end end end) end

for i,v in ipairs(conversions) do local button = create("TextButton")

{
    Size = UDim2.new(1,0,0,y);
    BackgroundColor = BrickColor.Black();
    TextColor = BrickColor.White();
    TextXAlignment = "Left";
    FontSize = "Size14";
    Position = UDim2.new(0,0,0,((i*y)+2)-(y+2));
    BorderSizePixel = 0;
    Font = "Legacy";
    Text = v.nam;
    ZIndex = 3;
    Parent = folder

}

local cost = create("TextLabel")

{
    Size = UDim2.new(0,0,1,0);
    BackgroundColor = BrickColor.Black();
    TextXAlignment = "Right";
    FontSize = "Size14";
    Position = UDim2.new(1,0,0,0);
    BorderSizePixel = 0;
    TextColor3 = Color3.new(20/255, 166/255, 0/255);
    Text = v.cost.."R$";
    ZIndex = 3;
    Parent = button

}

local buyTag = create("IntValue")

{
    Name = "market";
    Value = v.id;
    Parent = button;

}

local pointsTag = create("IntValue")

{
    Name = "points";
    Value = v.points;
    Parent = button;

}

buyItem(button)

end

local gui = main Tbutton.MouseButton1Click:connect(function() if Tbutton.Text == ">>" then gui:TweenPosition(UDim2.new(0,0,.5,-165), "Out", "Back", true,.5) header:TweenPosition(header.Position - UDim2.new(0,45,0,0), "In", "Quad", true) Tbutton.Text = "<<" else gui:TweenPosition(UDim2.new(0,-250,.5,-165), "Out", "Quad", true,.5) header:TweenPosition(UDim2.new(1,0,0,0), "In", "Quad", true) Tbutton.Text = ">>" end end)

--Azarth

I only changed that has to do with my ID number. Help me out.

1
Edit your post to correct the Lua formatting. BlueTaslem 18071 — 10y

Answer this question