Bump 5 and full script:
DB=false
script.Parent.DialogChoiceSelected:connect(function(player, choice)
-- Check the player has a stats object
local values= Workspace.Values
local stats = player:FindFirstChild('leaderstats')
if not stats then return end
Cash = stats:FindFirstChild('Cash')
if not Cash then return end
if choice == script.Parent.Building.Panel1 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel1.Value=true
values.Value= not values.Value
script.Parent.Building.Panel1:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel1.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
if choice == script.Parent.Building.Panel2 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel2.Value=true
values.Value= not values.Value
script.Parent.Building.Panel2:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel2.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
if choice == script.Parent.Building.Panel3 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel3.Value=true
values.Value= not values.Value
script.Parent.Building.Panel3:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel3.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
if choice == script.Parent.Building.Panel4 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel4.Value=true
values.Value= not values.Value
script.Parent.Building.Panel3:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel4.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
if choice == script.Parent.Building.Panel5 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel5.Value=true
values.Value= not values.Value
script.Parent.Building.Panel5:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel5.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
if choice == script.Parent.Building.Panel6 and DB==false then
print('test')
DB=true
if Cash.Value >= 500 then
Cash.Value = Cash.Value - 500
Workspace.Values.Panel6.Value=true
values.Value= not values.Value
script.Parent.Building.Panel6:Remove()
elseif Cash.Value <=500 then
script.Parent.Building.Panel5.ResponseDialog=("Sorry, you don't have the cash!")
end
DB=false
end
-------------------------------------------------------------
end) |