im making a button simulator and trying to make so when you have enough cash to buy it becomes neone but it only applies to 1 button
Script:
game.Players.PlayerAdded:Connect(function(plr)
local MainStats = plr:WaitForChild("MainStats")
local Cash = MainStats.Cash
local MBF = game.Workspace.Buttons
for _,Button in MBF:GetChildren() do
if Button:IsA("Folder") then
local Base = Button:WaitForChild("Base")
local Btn = Base.Btn
local Config = Base.Config
local Price = Config.Price
local function MNeon()
if Cash.Value >= Price.Value then
Btn.Material = "Neon"
end
end
while wait() do
MNeon()
end
end
end
end)
--Other lines of code...
local function MNeon()
while task.wait() do
if Cash.Value >= Price.Value then
Btn.Material = "Neon"
end
end
end
task.spawn(MNeon)