In the tycoon I'm working on, players create resources to sell to other players, so I've made buttons for purchasing them, however every attempt to make the scripts work the way I want has ended poorly. I'm not asking for someone to do it for me, but can someone point me in the right direction as to how to do it?
repeat wait() until script.Parent.Product.Value~=nil local product=script.Parent.Product.Value:Clone() script.Parent.Product.Value:remove() local price=script.Parent.Price.Value script.Parent.Name=script.Parent.ProductName.Value.." - "..price --sets name of brick if price==0 then script.Parent.Name=script.Parent.ProductName.Value.." - FREE" end script.Parent.Head.Touched:connect(function(hit) --this is how people buy it chr=hit.Parent plr=game.Players:GetPlayerFromCharacter(chr) if chr:findFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(chr) and plr.leaderstats.Money.Value>=price then if plr.Name==script.Parent.Parent.Parent.OwnerName.Value then plr.leaderstats.Money.Value=plr.leaderstats.Money.Value-price product.Parent=script.Parent.Parent.Parent script.Parent:remove() end end end)