This script is supposed to be a buy able house that when bought will heal the owner and kill others. But it does not kill the other players that walk in. It does nothing. Here is the script:
local Button = script.Parent
local debounce = true
local HasAccess = nil
function onTouch(Brick)
if debounce == true then
local Player = Brick.Parent
local Hum = Player:findFirstChild("Humanoid")
if (Hum ~= nil) then
local Location = game:GetService('Players'):GetPlayerFromCharacter(Player)
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.Name .. "'s House"
HasAccess = Player.Name
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
script.Parent.CanCollide = false
script.Parent.Transparency = .62
debounce = false
end
end
end
end
end
Button.Touched:connect(onTouch)
function Vip(Brick)
if script.Parent.Parent.Name ~= "House For Sale - 20 Gold" then
local Toucher = Brick.Parent
local Hum = Toucher.Humanoid
if Hum ~= nil then
if Toucher.Name == HasAccess then
Hum.Health = Hum.MaxHealth
else Hum.Health = 0
end
end
end
end
Button.Touched:connect(Vip)
