#Trying to make a underglow shoping system, and failing miserably

1 messages · Page 1 of 1 (latest)

calm dagger
#

the local script is that:

local frame = script.Parent
local prompt = workspace.underglow.ProximityPrompt

prompt.Triggered:Connect(function()
frame.Visible = true
prompt.Enabled = false
end)

frame.ImageButton.MouseButton1Click:Connect(function()
frame.Visible = false
prompt.Enabled = true
end)

local player = game:GetService("Players").LocalPlayer
local data = player:FindFirstChild("Data2")
if data == nil then return end
local value = data:FindFirstChild("underglow")
if value == nil then return end
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats == nil then return end

local colors = {
red = 1500,
orange = 2500,
yellow = 1000,
green = 3000,
blue = 4500,
purple = 4000,
pink = 3500,
white = 7500,
aqua = 5500,
cyan = 4500,
}

local function BuyColor(color)
if leaderstats.Cash.Value < colors[color] then
return
end

if value.Value == color then
    return
end

value.Value = color
leaderstats.Cash.Value -= colors[color]

end

frame.red.MouseButton1Click:Connect(function()
BuyColor("red")
end)

frame.orange.MouseButton1Click:Connect(function()
BuyColor("orange")
end)

frame.yellow.MouseButton1Click:Connect(function()
BuyColor("yellow")
end)

frame.green.MouseButton1Click:Connect(function()
BuyColor("green")
end)

frame.blue.MouseButton1Click:Connect(function()
BuyColor("blue")
end)

frame.purple.MouseButton1Click:Connect(function()
BuyColor("purple")
end)

frame.pink.MouseButton1Click:Connect(function()
BuyColor("pink")
end)

frame.white.MouseButton1Click:Connect(function()
BuyColor("white")
end)

frame.aqua.MouseButton1Click:Connect(function()
BuyColor("aqua")
end)

frame.cyan.MouseButton1Click:Connect(function()
BuyColor("cyan")
end)

timid plover
#

Whats the problem

calm dagger