Tycoon deletion script

Hello everyone, can someone help me create a script when a player leaves the tycoon disappears? Im also ready to pay a few hundred robux if the problem is solved.

Wait you want the whole tycoon to disappear or just ownership of the tycoon which I’m assuming you would want.

1 Like

Yes, i want that the ownership is getting removed and also the buildings he bought. Idk if that is a problem but i have a database

Do you know how to do delete the progress of an tycoon if someone left?

if the player leaves then destroy the tycoon or replace with a plain one so other can claim it

local tycoon = workspace.tycoon -- here is your tycoon

local function playerleaving(plr)
if plr then
-- specific tycoon to be delete for ex
tycoon.tyccon2:Destroy
end
end

game.Players.PlayerLeaving:Connect(playerleaving)

if you want you can replace the tycoon if you don’t want to destroy it and put this in serverscript because everyone can see if this is destroy!

This is my script

local tycoon = workspace.Tycoons.Tycoon1 -- here is your tycoon

local function playerleaving(plr)
	if plr then
		tycoon.TycoonTemplate:Destroy
	end
end

game.Players.PlayerLeaving:Connect(playerleaving)

image
image

in destroy

put “()” because it is a function

image

oh Sorry rather than playerleaving it is actually playerRemoving

Still not a valid member.

image

change “game.Players.PlayerLeaving” to “game.Players.PlayerRemoving”

Okay, now I get no error and its not removing

hey can you show the script again and also the path direction for which tycoon you want to delete


image

Do you want to join me in Team Create?

are “BOOO1” are different tycoons?

and in “game.Players.playerRemoving”

change the playerRemoving to “PlayerRemoving” as functions are always capital and also change the function playerRemoving to other like playerleaving so it does not confuse you and remove the brackets in playerRemoving as it is no use

change “game.Player.playerRemoving” to “game.Players.PlayerRemoving:Connect(-- the function)”

1 Like

Hey, Thankyou very much can you join me quick in Team Create that I can show you something?

Your Welcome, but sorry i can’t come on TeamCreate now!

When I leave, the cash collector is still going up. Is there a way to reset it?
image

like can you give or show examples?