Im making a tycoon and I am trying to add to my script to see if the owner of the tycoon left.
Im wondering if this would work:
val = script.Parent.OwnerText.SurfaceGui.TextLabel
pl = game:GetService("Players")
if val.Text ~= "No Owner" and pl:FindFirstChild(tostring(val.Text)) == false then
print("Owner left so no owner")
end
Please answer/help with my question! Thanks.

4 comments
Well, it should work but, there is a better way to doing this using game.Players.PlayerRemoving.
Could you make an answer explaining it please?
Question tho, is this script located under the tycoon?
Basically, it's in the owner door part.