I am trying to make a SurfaceGui shop that gets all items in a Folder, clones the frame and changes the frame.ItemName
(TextLabel).Text
to the name of it. But for some reason I can't get this script to work.
local sp = script.Parent local folder = sp.ScrollingFrame local player = script.Parent.Parent.Parent.Parent function refresh() folder:ClearAllChildren() for _,item in pairs(game.ServerStorage.ShopItems:GetChildren()) do local frame = script.Frame:Clone() frame.Parent = folder frame.ItemName.Text = item.Name " : "..item.Price.Value.."" frame.Name = item.Name frame.Purchase.MouseButton1Click:connect(function(c) if player:FindFirstChild("globalstats").Points.Value < item.Price.Value then return false else player:FindFirstChild("globalstats").Points.Value = player:FindFirstChild("globalstats").Points.Value - item.Price.Value local itemt = item.Tool:Clone() itemt.Parent = player.Backpack itemt.Name = item.Name end end) end end game.Players.PlayerAdded:connect(function(p) wait(1) refresh() end)
Output show's no error's, can anyone tell me why it won't work?