Alright, so I have a shop script and I’m trying to make a function that fires a different event depending on which button was pressed, but I’m getting Players.CodedCrystal.PlayerGui.ShopGUI.ShopScript:75: Expected ')' (to close '(' at column 60), got '(' - Studio - ShopScript:75
I’m not quite sure where this extra ‘)’ is supposed to go and I’m pretty lost
Here’s the full code just incase something else is causing this
local repStorage = game:GetService("ReplicatedStorage")
local ClickDetector = workspace.ShopNPC.ClickDetector
local ShopEvents = repStorage.ShopEvents
local ShopGUI = script.Parent
local CloseButton = ShopGUI.CloseButton
local ShopFrame = ShopGUI.ShopFrame
local PowerUpFrame = ShopFrame.PowerUpFrame
local WeaponFrame = nil
local AbilityFrame = nil
local SpeedFolder = PowerUpFrame.Speed
local AttackFolder = PowerUpFrame.Attack
local HealthFolder = PowerUpFrame.Health
local EventsTable = {
speed = ShopEvents.buySpeed1,
speed2 = ShopEvents.buySpeed2,
speed3 = ShopEvents.buySpeed3,
attack = nil,
attack2 = nil,
attack3 = nil,
health = ShopEvents.buyHealth1,
health2 = ShopEvents.buyHealth2,
health3 = ShopEvents.buyHealth3
}
local ButtonsTable = {
BuySpeed = SpeedFolder.BuySpeedOne,
BuySpeed2 = SpeedFolder.BuySpeedTwo,
BuySpeed3 = SpeedFolder.BuySpeedThree,
BuyAttack = nil,
BuyAttack2 = nil,
BuyAttack3 = nil,
BuyHealth = HealthFolder.BuyHealthOne,
BuyHealth2 = HealthFolder.BuyHealthTwo,
BuyHealth3 = HealthFolder.BuyHealthThree
}
local debounce = false
-- Opening the shop
ClickDetector.MouseClick:Connect(function()
if ShopGUI.Enabled == true then
return 0
end
ShopGUI.Enabled = true
WeaponFrame.Enabled = true
PowerUpFrame.Enabled = false
AbilityFrame.Enabled = false
end)
-- Setting up buying functions
local function BuySpeed(event)
if debounce then
return 0
end
event:FireServer()
debounce = true
wait(1)
debounce = false
end
local function BuyHealth(event)
if debounce then
return 0
end
event:FireServer()
debounce = true
wait(1)
debounce = false
end
-- Other button functions
CloseButton.MouseButton1Click:Connect(function()
ShopFrame.Visible = false
end)
-- All bought events
ButtonsTable["BuySpeed"].MouseButton1Click:Connect(function(BuySpeed(EventsTable["speed"]))
end)
I know there’s an answer to this somewhere as I already had to fix this once, and my dad was able to find something, but I have no idea what the thing was called, or what I would look up for this specific issue.