Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How To Make A BUY Button That Takes Away Money And Gives An Item?

this is a bit of code i tried and it worked (i got the item) but it didnt takeaway money can anyone help?

function Give(x)
	local y = x.Backpack
	local z = game.Lighting["Octopus"]
	z:Clone().Parent = y   
end

script.Parent.ClickDetector.MouseClick:connect(Give)

1 comment

0

It's because you never programmed it to do so. Access the Player's leaderstats via the Player pointer passed from MouseClick, modify the respective stat. Please also use ReplicatedStorage to store Instances. ROBLOX methods now follow title-case, please use :Connect().

1 answer

you need to make a local script where you going to click the button and then make a event to prevent hackers and check if the player have enough money if he do you going to take away money copy the item and put it in the player inventory this is the best answer you can get because its more then just a script

6 comments

0

Do u mind showing me what the script would look like? im new to scripting and i dont understand alot of what you said

0

This isn't needed.

0

Jumpy he doesn't know how to script, he's a troll.

0

oh ok thanks

0

Please do not post answers without code or proper explanations. Use comments for ideas like this but no answer.

0

you guys are so dump I can show you the whole prosses you need a more then one scripts and events and remote functions and if you think I'm a troll and I don't know how to script go to Roblox games search up Free Shot and see my game

This discussion is preserved as it was. New answers, comments, and votes are closed.