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?
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
: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.