Hello! Im currently trying to make a Roblox Economy Game, I made a shop cald " Bloxy, Bloxy Counter " and you can work at it, but the issue is, when I made a buy cola button ( for 1.5 or more dollars )
The BuyColaButton1
local BuyColaButton1 = script.Parent
local host = game.Players.LocalPlayer
local tool = game.ServerStorage:FindFirstChild("BloxyCola")
local debounce = false
local function PressedButton()
wait(1)
if not debounce then
debounce = true
if game.Players.LocalPlayer.Touched == game.Workspace.BuyColaButton1 == true then -- Checks if the player touched the Buy Button
if game.Players.LocalPlayer.leaderstats.Robux.Value == 1.5 or math.abs(1.5 - 10000000000000000000) then -- Checks if the Player has a balance that goes from 1.5 to 10000000000000000000
game.Players.PlayerAdded:Connect(function(plr) -- needed an extra 's' at the end of players
plr.CharacterAdded:Connect(function(char)
-- activates the part
BuyColaButton1.BrickColor = BrickColor.new("Lime green")
wait(1)
-- deactivates the part
BuyColaButton1.BrickColor = BrickColor.new("Really red")
BuyColaButton1.SurfaceGui.TextLabel.Text = "Brought!"
debounce = false
local backpack = plr:WaitForChild("Backpack") -- Gives The player a Bloxy Cola
for _,v in pairs(host) do
if plr.Name == v then
local newTool = tool:Clone()
newTool.Parent = backpack
newTool.Name = "Bloxy Cola"
game.Players.LocalPlayer.leaderstats.Robux.Value = game.Players.LocalPlayer.leaderstats.Robux.Value - 1.5 -- Takes 1.5 dollars from the Player Who stepped on the pad
wait(0.5)
BuyColaButton1.BrickColor = BrickColor.new("Lime green")
BuyColaButton1.SurfaceGui.TextLabel.Text = "Buy Cola 1.5R"
else
if game.Players.LocalPlayer.Touched == game.Workspace.BuyColaButton1 == true then -- Checks if the player touched the Buy Button
if game.Players.LocalPlayer.leaderstats.Robux.Value == 0.00 or math.abs(0.00 - 1.49) then -- Checks if the Player has a balance that goes from 0.00 to 1.49
-- activates the part
BuyColaButton1.BrickColor = BrickColor.new("New Yeller")
BuyColaButton1.SurfaceGui.TextLabel.Text = "Not Enough Robux!"
wait(1)
-- deactivates the part
BuyColaButton1.BrickColor = BrickColor.new("Lime green")
BuyColaButton1.SurfaceGui.TextLabel.Text = "Buy Cola 1.5R"
end
end
end
end
end
end
wait(3)
BuyColaButton1.Touched:Connect(PressedButton) -- triggers the function in the parentheses when touched
The Output
10:34:25.058 The Roblox Economy auto-recovery file was created - Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
10:34:26.262 Workspace.BuyColaButton1.BuyerHandle:54: Expected ')' (to close '(' at line 14), got 'end' - Studio - BuyerHandle:54
10:34:36.945 0.5, 0.5 - Server
10:34:37.216 0.5, 0.5 - Client
10:34:58.949 Disconnect from ::ffff:127.0.0.1|53830 - Studio
10:34:59.259 Player Data successfully saved! - Server - DataStores:35
