First Script:
local Button = script.Parent
function onTouch(Brick)
local Player = Brick.Parent:findFirstChild("Humanoid")
if (Player ~= nil) then
local Location = game:GetService('Players'):GetPlayerFromCharacter(Player.Parent)
if Location:WaitForChild("leaderstats").Gold.Value >= 20 then
for i = 1,1 do
Location:WaitForChild("leaderstats").Gold.Value = Location:WaitForChild("leaderstats").Gold.Value - 20
script.Parent.Parent.Name = "Yay"
local Color1 = BrickColor:Random()
local Color2 = BrickColor:Random()
script.Parent.Parent.Wall1.BrickColor = Color1
script.Parent.Parent.Wall2.BrickColor = Color1
script.Parent.Parent.Wall3.BrickColor = Color1
script.Parent.Parent.Floor.BrickColor = Color2
script.Parent.Parent.Head.BrickColor = Color2
script.Parent.Parent.Roof.BrickColor = Color2
end
end
end
end
Button.Touched:connect(onTouch)
Second Script :
local Button = script.Parent
function onTouch(Brick)
local Player = Brick.Parent:findFirstChild("Humanoid")
if (Player ~= nil) then
local Location = game:GetService('Players'):GetPlayerFromCharacter(Player.Parent)
if Location:WaitForChild("leaderstats").Gold.Value >= 20 then
for i = 1,1 do
Location:WaitForChild("leaderstats").Gold.Value = Location:WaitForChild("leaderstats").Gold.Value - 20
script.Parent.Parent.Name = Player .. "'s House"
local Color1 = BrickColor:Random()
local Color2 = BrickColor:Random()
script.Parent.Parent.Wall1.BrickColor = Color1
script.Parent.Parent.Wall2.BrickColor = Color1
script.Parent.Parent.Wall3.BrickColor = Color1
script.Parent.Parent.Floor.BrickColor = Color2
script.Parent.Parent.Head.BrickColor = Color2
script.Parent.Parent.Roof.BrickColor = Color2
end
end
end
end
Button.Touched:connect(onTouch)

1 comment
difference is in line ten