objects = {} wait(1)
script.Parent:WaitForChild("Buttons") for i,v in pairs(script.Parent.Buttons:GetChildren()) do if v:FindFirstChild("Head") then
local oject = script.Parent.Purchases:FindFirstChild(v.Object.Value) if objects ~= nil then objects[object.Name] = object:Clone{} object:Destory() else print("Button: "..v.Name.." is missing its object and has been removed.") v.CanCollide = false v.Transparency = 1 end v.Head.Touched:connect(function(hit) local player = game.PlayersGetPlayerFromCharacter(hit.Parent) if v.Head.CanCollide == true if player ~= nil then if script.Parent.Owner.Value == player then if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.Health > 0 then local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) if cashmoney ~= nil then if cashmoney.Value >= v.Price.Value then cashmoney.Value = cashmoney.Value - v.Price.Value objects[v.Object.Value].Parent= script.PurchasedObjects v.Head.CanCollide = false v.Head.Transparency = 1 end end end end end end end end) end end
object
is spelled incorrectly as oject
on (what is currently) line 1.
game.PlayersGetPlayerFromCharacter
is written on line 12; it should read game.Players:GetPlayerFromCharacter
.
if v.Head.CanCollide == true
is missing then
after it on line 13.