local TeamChecker = script.Parent
TeamChecker.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print("touched works")
local Tycoons = game.Workspace["Zednov's Tycoon Kit"].Tycoons
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
for _,child in pairs(Tycoons:GetChildren()) do
if child.Owner.Value == nil then
print("child found")
player.TeamColor = child.TeamColor.Value
child.Owner.Value = player
player.RespawnLocation = child.Essentials.Spawn
hit.Parent:WaitForChild("Head"):Remove()
print("before break")
break
end
end
wait(0.1)
end
end)
The problem is, every child.Owner.Value gets the same player as Value… The team color only works for the first one who joined.
(Only in the yellow park is someone)
It worked when i had all the tycoon spawns set to neutral enabled, I now disabled it because that are team spawns. All players spawn on the part where the script is located in. But they don’t get resetted + they don’t get a team.
Means, every Tycoon got the same owner, but the owner should only have 1 tycoon. Somehow the break doesn’t work
local TeamChecker = script.Parent
TeamChecker.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
print("touched works")
local Tycoons = game.Workspace["Zednov's Tycoon Kit"].Tycoons
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
for _,child in pairs(Tycoons:GetChildren()) do
if child.Owner.Value == nil and player.Team == game.Teams['For Hire'] then
print("child found")
player.TeamColor = child.TeamColor.Value
child.Owner.Value = player
player.RespawnLocation = child.Essentials.Spawn
hit.Parent:WaitForChild("Head"):Remove()
print("before break")
break
end
end
wait(0.1)
end
end)