Can someone fix my buy button script?
I have a house which you can buy in game, the first time you buy it everything works fine. But once you sold the house, it won't let you buy it again for some reason :L
Please help if you can...Thanks !
Buy house script:
01 | owned = script.Parent.Parent.Parent.Owned.Value |
03 | script.Parent.Touched:connect( function (hit) |
04 | player = game.Players:GetPlayerFromCharacter(hit.Parent) |
05 | if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then |
06 | if owned = = false and player.Cash.Value > = 1000 and player.HasHouse.Value = = false then |
07 | player.Cash.Value = player.Cash.Value - 1000 |
08 | clone = game.Lighting.House:clone() |
09 | clone.Parent = player.PlayerGui |
10 | player.HasHouse.Value = true |
11 | player.PlayerGui.House.Frame.House 1. Visible = true |
12 | player.PlayerGui.House.Frame.lockhouse 1. Visible = true |
13 | player.PlayerGui.House.Frame.lightson 1. Visible = true |
14 | player.PlayerGui.House.Frame.curtainsclose 1. Visible = true |
15 | player.PlayerGui.House.Frame.bathroom 1. Visible = true |
16 | player.PlayerGui.House.Frame.kitchen 1. Visible = true |
17 | player.PlayerGui.House.Frame.bedroom 1. Visible = true |
18 | script.Parent.Parent.Parent.Owned.Value = true |
19 | script.Parent.Parent.Parent.OwnedBy.Value = player.Name |
20 | script.Parent.Parent:remove() |
22 | print ( "Not enough to purchase house." ) |
Sell house script:
02 | plr = script.Parent.Parent.Parent.Parent.Parent |
04 | game.Workspace.Housee 1 :remove() |
05 | clone = game.Lighting.Housee 1 :clone() |
07 | clone.Parent = game.Workspace |
08 | game.Workspace.Kitchen:remove() |
09 | game.Workspace.Bedroom:remove() |
10 | game.Workspace.Bathroom:remove() |
11 | game.Workspace.LivingRoom:remove() |
13 | plr.Cash.Value = plr.Cash.Value+ 500 |
14 | plr.PlayerGui.House:remove() |
15 | plr.HasHouse.Value = false |
22 | script.Parent.MouseButton 1 Down:connect(Click) |
I use a Gui for in game currency by the way, not a leaderboard.