So I have got code already, which buys a part. But I want to introduce tables, so I've added a table. But I now need a listening function for everything in a model, so I can replace workspace.dropTwoBuy. Any ideas? ~~~~~~~~~~~~~~~~~ Prices = {5} Buyables = {game.ServerStorage.Giver2}
workspace.dropTwoBuy.Head.Touched:connect(function(x)
if x.Parent.Name == owner and game.Players[owner].leaderstats.Points.Value == 5 then
y = game.ServerStorage.Giver2:Clone()
y.Parent = workspace
wait(1)
workspace.dropTwoBuy:Destroy() end
end)
~~~~~~~~~~~~~~~~~
You could do a generic for loop, and listen on each instance that way.
model = workspace.Model for _, part in pairs(model:GetChildren()) do part.Touched:connect(function() part.BrickColor = BrickColor.Blue() end) end
Sorry I can't tab on mobile.
Prices = {5} Buyables = {game.ServerStorage.Giver2} workspace.dropTwoBuy.Head.Touched:connect(function(x) if x.Parent.Name == owner and game.Players[owner].leaderstats.Points.Value == 5 then y = game.ServerStorage.Giver2:Clone() b = workspace.Reciever b.Size = Vector3.new(14, 2, 4.8) y.Parent = workspace wait(1) b.Position = Vector3.new(37.1, 1, -12) workspace.dropTwoBuy:Destroy() end end)