Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make it when the player leaves the house becomes no ones?

So i have a code i want the buy sign to come back and text when the play leaves the game so no one owns the house this is my code

debounce = false

script.Parent.BuySign.Buy.MouseClick:connect(function(player)
	if game.Players:findFirstChild(player.Name) ~= nil and not debounce and game.Players:findFirstChild(player.Name):FindFirstChild("HomeOwner") == nil then
		if player.Cash.Value >= 500 then
			player.Cash.Value = player.Cash.Value - 500
			debounce = true
			script.Parent.BuySign:Destroy()
			script.Parent.Owner.Value = player.Name
			local own = Instance.new("BoolValue")
			own.Name = "HomeOwner"
			own.Parent = game.Players:findFirstChild(player.Name)
		end
	end
end)

I do not know what to replace BuySign:Destory() with aswell because then you cannot get it back May someone help me please.

1 comment

0

Use PlayerRemoving function not if players:findfirstchild(0 etc

1 answer

Here, use the player removing function..

owner = "jimmy"
game.Players.PlayerRemoving:connect(function(plr)
if plr.Name == owner then
-- Your stuff to make the house not owned...
end

This discussion is preserved as it was. New answers, comments, and votes are closed.