Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Prestory 1395 Moderation Voter
7 years ago

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.

0
Use PlayerRemoving function not if players:findfirstchild(0 etc farrizbb 465 — 7y

1 answer

Log in to vote
0
Answered by
4D_X 118
7 years ago

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
Ad

Answer this question