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

Why does this Surface GUI shop button not work for my money system?

I recently made a Surface GUI with shop buttons for my club. I'm trying to test it and when I click the button it doesnt give me the item nor does it take away my money. I made a script that creates a Intvalue in your player that is set to the amount of money you have, and you gain more money the more you play. Here is the code for it.

local DataStore = game:GetService("DataStoreService")
local ds1 = DataStore:GetDataStore("TMAN6841244")
local ds2 = DataStore:GetDataStore("TMAN6844446244")
local ds3 = DataStore:GetDataStore("TMAN68444462444564")
local ds4 = DataStore:GetDataStore("TMAN684444624445645454543")
game.Players.PlayerAdded:connect(function(p)
	local BankRollBux = Instance.new("IntValue")
	local SW = Instance.new("IntValue")
	local OC = Instance.new("IntValue")
	local Mo = Instance.new("IntValue")
	Mo.Parent = p
	Mo.Name = "Mo"
	OC.Parent = p
	OC.Name = "OC"
	SW.Parent = p
	SW.Name = "SW"
	BankRollBux.Parent = p
	BankRollBux.Name = "BRB"
	Mo.Value = ds4:GetAsync(p.UserId) or 0
	OC.Value = ds3:GetAsync(p.UserId) or 0
	SW.Value = ds2:GetAsync(p.UserId) or 0 
	BankRollBux.Value = ds1:GetAsync(p.UserId) or 0
	ds4:SetAsync(p.UserId, Mo.Value)
	ds3:SetAsync(p.UserId, OC.Value)
	ds2:SetAsync(p.UserId, SW.Value)
	ds1:SetAsync(p.UserId, BankRollBux.Value)
	BankRollBux.Changed:connect(function()
		print("Saving")
		ds1:SetAsync(p.UserId, BankRollBux.Value)
		ds2:SetAsync(p.UserId, SW.Value)
		ds3:SetAsync(p.UserId, OC.Value)
		ds4:SetAsync(p.UserId, Mo.Value)
		print("Saved")
	end)
end)
game.Players.PlayerRemoving:connect(function(p)
	ds1:SetAsync(p.UserId, p.BRB.Value)
	ds2:SetAsync(p.UserId, p.SW.Value)
	ds3:SetAsync(p.UserId, p.OC.Value)
	ds4:SetAsync(p.UserId, p.Mo.Value)
end)

I finished the script for the button on the surface gui and it does not work for the money system I use. Any Help? Here is the code for the button I have set up in the surface gui.

wait(0.5)
Player = game.StarterGui.Parent
price = 100
tool = game.Lighting:findFirstChild("Burger") -- put the excact weapon name here. the weapon has to be in game Lighting


function buy()
if Player.BRB.Value >= price then
Player.BRB.Value = Player.BRB.Value - price
local a = tool:clone()
a.Parent = Player.Backpack

end
end
script.Parent.MouseButton1Click:connect(buy)

1 answer

Your script is using too much deprecated code and it's not yours. Scripting Helpers is finding help for code you wrote, not code you found from free models.

3 comments

0

Then find this in free models, I wrote this code for BankrollXTC back when bankroll was a thing, I still have rights to teamcreate on the game I wrote this for so instead of false accusations try helping next time.

0

Prove you made it. It literally says "the weapon has to be in game Lighting" and using lighting as storage is deprecated

0

And you literally think that the StarterGui service's parent is the player...learn more.

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