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

Could someone tell me what i am doing wrong on this developer product localscript?

Asked by 9 years ago

So, i wanted to make this product that gives a Tri-laser to anyone who buys the product. heres my code that i am having trouble with.

local ProductID = 19312479 -- ID of the developer product
if DoAcceptPurchase = true then -- whats wrong with this part? i put "then".
    Game.Lightning.Trilaser:Clone()
    FirstFindChild "Playername" 
    Game.Players."playername":Paste() -- i dont really think this will work...
    -- @Above, i wanted to make the player who buys the product get it, but i dont know how to do it.
    -- i dont know how to make onclick functions or anything.
end

so i don't know if :Paste() is a real function or not. also, the playername thing is not going to work out. i want to find out how i can get the player's name who bought the product and paste it to him/her. i also have a GUI named purchaseproduct in the starterGUI but i don't know how to make an OnClick function to even pull up the screen to purchase the product so im just stuck. any ideas?

0
Main idea: Stop scripting. Never script anything ever again. Don't even try. iaz3 190 — 9y

2 answers

Log in to vote
0
Answered by
iaz3 190
9 years ago

This will work

print('We will not do everything for you, please consult the wiki before mashing in random words that sound scriptey like.')

your code fixed(btw your code will never work the way you want, if at all. rewrite it) is this:

local ProductID = 19312479 -- ID of the developer product
if DoAcceptPurchase == true then -- when COMPARING you use "==" But what is DoAcceptPurchase? You do not define it, and it isnt some magic variable thing that is true if someone buys your thing. You don't even ASK the player to buy it anywhere in this code.
    local x = Game.Lightning.Trilaser:Clone()
local plr = game.Players:FirstFindChild("Playername")
    if plr then  -- You're looking for a player called "PlayerName" ? There will never be such a player
    x.Parent = plr
    end

     --Now looking to paste it into ANOTHER player? Since case matters.
end


Ad
Log in to vote
-1
Answered by 9 years ago
:Paste()

Thats not a function.

One way to Clone something and move it to a players Backpack is this: ( This is an example )

a = game.Lighting.Trilaser:Clone()
a.Parent = game.Players.ggggyourface23.Backpack

Since :Paste is not a function I made a clone of Trilaser and pasted it into my into my players backpack.

As for you not only used an invalid function, but you also did not paste it into the correct place.

0
ok thanks guys. maybe i should get more experience before trying this again. TroytheDestroyer 75 — 9y

Answer this question