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)
Button = script.Parent Access = "N/A" Cost = 20 --amount of gold they need to purchase a house function debounce(func) local isRunning = false return function(...) if not isRunning then isRunning = true func(...) isRunning = false end end end script.Parent.Touched:connect(debounce(function(hit) if hit.Parent and game.Players:GetPlayerFromcharacter(hit.Parent) then p = game.Players:GetPlayerFromcharacter(hit.Parent) if p.Name == Access then Button.CanCollide = false Button.Transparency = 0.7 wait(0.5) Button.CanCollide = true Button.Transparency = 0 elseif not Access == "N/A" then p.Character:BreakJoints() elseif Access == "N/A" then l = p:WaitForChild("leaderstats") g = l.Gold.Value if (g >= Cost) and not game.Workspace:findFirstChild(p.Name.."'s House") and Access == nil then script.Parent.Parent.Name = p.Name.."'s House" --this should lead to the Model. To get the name to show, put a humanoid inside the brick you want the name to appear above g = g - Cost Access = p.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 end end end end))
PassOrShirtID = 126955753 -- Change this to your asset/shirt/badge/pass ID Door = script.Parent -- Change this to the door (if needed) OpenTime = 1 -- Change how long you want the door open
--Do not touch below-- Serv = game:GetService("BadgeService") MServ = game:GetService("MarketplaceService") if not _G.Players then _G.Players = { [PassOrShirtID] = {}; } print("Players Created") elseif not _G.Players[PassOrShirtID] then _G.Players[PassOrShirtID] = {}; print("Players.Pass created") end
Table = _G.Players[PassOrShirtID]
function CheckPlayer(player2) for i = 1,#Table do if Table[i] == player2 then return true end end return false end
Door.Touched:connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then player = game.Players:GetPlayerFromCharacter(hit.Parent) if Serv:UserHasBadge(player.userId,PassOrShirtID) or CheckPlayer(player) then Door.CanCollide = false; Door.Transparency = 0.5; wait(OpenTime); Door.CanCollide = true; Door.Transparency = 0; else if Prompt then -- nikilis MServ:PromptPurchase(player,PassOrShirtID) h = player.Character:FindFirstChild("Humanoid") if h then h.WalkSpeed = 0 end local con; con = MServ.PromptPurchaseFinished:connect(function(ply,asset,purch) if ply == player and asset == PassOrShirtID then con:disconnect() if purch then if h then h.WalkSpeed = 16 end table.insert(Table,player) else player.Character:BreakJoints() end end end) else player.Character:BreakJoints() end end end end)
-- Made by BuildingAustin