So basically this script will detect if the owner of the tycoon leaves, and then will reset the whole thing. I got a friend to test it with me and when I took the tycoon and rejoined, it reset like normal. And then when she took the tycoon and rejoined, it reset. The problem is that when she rejoin and I touched the "claim tycoon" door, none of the buttons worked for me. I can't seem to find the problem in the script. Any help is appreciated. Thank you

local newTycoon = script.Parent.Tycoon:Clone()

script.Parent.Tycoon.OwnerName.Changed:connect(function()
while true do
wait()
local owner = game.Players:FindFirstChild(script.Parent.Tycoon.OwnerName.Value)
if owner == nil then
script.Parent.Tycoon:Remove()
TycoonClone = newTycoon:Clone()
TycoonClone.Parent = script.Parent
TycoonClone:MakeJoints()
script.Disabled = true
wait(0.1)
script.Disabled = false
break
end 
end
end) 

and here's the claiming script

script.Parent.Head.Touched:connect(function(hit)
	chr=hit.Parent
	if chr:findFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(chr) then
		plr=game.Players:GetPlayerFromCharacter(chr)
		if not plr.hastycoon.Value then
			plr.hastycoon.Value=true
			script.Parent.Parent.OwnerName.Value=plr.Name
			script.Parent:remove()
		end
	end
end)

--hastycoon is a BoolValue in leaderstats

2 comments

0

Where is the claiming script?

0

Editted it in, thanks for inquiring