ServerScript. First of all I'm trying to make a tycoon without getting help with kits and stuff like that. I made it pretty good but I'm facing a problem where people can claim as many tycoons as they want and I'm trying to fix that. I tried adding a for i,v in pairs() line to detect if they have the BoolValue that assigns when a player enters a tycoon and if they have one i return the code so it does not run. Here's the code currently there for me:
local gate = script.Parent
local debounce = true
gate.Touched:Connect(function(part)
if debounce == true then
debounce = false
if game.ReplicatedStorage.InTycoon4.Parent == game.ReplicatedStorage then
print("InTycoon4 is still in RS, Continue")
if part.Parent:FindFirstChild("Humanoid") then
print("Humanoid detected!")
local perm = game.ReplicatedStorage.InTycoon4
perm.Value = false
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
print("It's a player!")
local findBool = player:GetChildren()
for i,v in pairs(findBool) do
if v:IsA("BoolValue") then
print("A BoolValue has been found!")
return
else
perm.Parent = player
gate.Transparency = 0.5
gate.CanCollide = false
perm.Value = true
gate.SurfaceGui.TextLabel.Text = player.Name.."'s Tycoon"
end
if not perm.Parent == player then
print("Tycoon already claimed")
return
end
end
end
end
end
end
end)
I want you to focus on lines if player then to else and if you find another error in the code outside of these lines you're free to tell them.
When I run the game and test it if it doesn't allow the player from entering another tycoon it didn't work and the output didn't even print anything pls help.
Thank u.

3 comments
It didn't print any outputs?
Try replacing line 8 with if game.ReplicatedStorage:FindFirstChild("InTycoon4") and game.ReplicatedStorage.InTycoon4.Parent == game.ReplicatedStorage then?
Oops sorry I that part of the code worked but the thing not working is between lines 21-35 Thanks for your help tho.