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.
Sample script of what I mentioned in the comments:
local Owner = --The tycoon owner value game.Players.PlayerRemoving:Connect(function(player) --A function that is activated when a player leaves if player.Name == Owner.Value then --Check if that player that left was the owner of the tycoon print("Owner has left the game") --Rest of your code here end end)