player.PlayerGui.ShopGui.MainFrame.ButtonFrame.ExitButton.MouseButton1Click:Connect(function()
player.PlayerGui.ShopGui.Enabled = false
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.L.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = true
if player.leaderstats.Money.Value > 20 then
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 20 then
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
end)
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Lemonade') then
local SwordClone = game.ReplicatedStorage.Lemonade:Clone()
SwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.B.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = true
if player.leaderstats.Money.Value > 40 then
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 40 then
player.PlayerGui.Confirmation.Frame.YesButton.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Egg') then
local LongSwordClone = game.ReplicatedStorage.Egg:Clone()
LongSwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.C.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = true
if player.leaderstats.Money.Value > 80 then
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 80 then
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
end)
end
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Cheeseburger') then
local SwordClone = game.ReplicatedStorage.Cheeseburger:Clone()
SwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
end)
end
end)
end
end)
end)
end
end)
end
Error:
ServerScriptService.ShopScript:67: Expected ‘)’ (to close ‘(’ at line 48), got ‘end’
Basically, for every “then” or “function” there needs to be an “end”. And for every opening “(” or “[” there needs to be a closing “)” or “]”.
The reason you are having this issue because you have connections inside connections inside connections which can get really confusing. Generally you would want all connections to be standalone meaning they are not inside another connection. Then those connections would check for conditions before they run.
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.ExitButton.MouseButton1Click:Connect(function()
player.PlayerGui.ShopGui.Enabled = false
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.L.MouseButton1Click:Connect(function()
if player.leaderstats.Money.Value > 20 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 20 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Lemonade') then
local SwordClone = game.ReplicatedStorage.Lemonade:Clone()
SwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.B.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = true
if player.leaderstats.Money.Value > 40 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.Cancel.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 40 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.YesButton.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Egg') then
local LongSwordClone = game.ReplicatedStorage.Egg:Clone()
LongSwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
end)
player.PlayerGui.ShopGui.MainFrame.ButtonFrame.C.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = true
if player.leaderstats.Money.Value > 80 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
player.PlayerGui.Confirmation.Enabled = false
if player.leaderstats.Money.Value < 80 then
--do stuff
end
end)
player.PlayerGui.Confirmation.Frame.Accept.MouseButton1Click:Connect(function()
if not player.Backpack:findFirstChild('Cheeseburger') then
local SwordClone = game.ReplicatedStorage.Cheeseburger:Clone()
SwordClone.Parent = player.Backpack
player.PlayerGui.Confirmation.Enabled = false
else
player.PlayerGui.Confirmation.Enabled = false
end
end)
I made an effort to clean everything up, you’ll need to fix how everything is arranged.
Yeah, you need to define the player (you didn’t in the originally provided script). If this is a local script then you can just use “game.Players.LocalPlayer”.
If I Explain It, It Would Be Alot Easier. So What Im trying To Make Is an NPC tool giver which cost’s money (intval), the gui is in starter gui and it gives
The error i mentioned earlier, the reason i dont wanna share the game file is because its kinda an private project