local AllPlots = workspace.Plots:GetChildren() for i, v in pairs(AllPlots) do if v[i].ClaimDoor.Rig.Rig.OwnerName.Value == "" then -- Plot is empty v[i].ClaimDoor.Rig.Rig.OwnerName.Value = Plr.Name workspace:WaitForChild(Plr.Name).PrimaryPart.CFrame = v[i].PrimaryPart.CFrame break end end
I was using this code from another answer, but it does not work.
You should provide more details, like: Does everything work except the teleport? When does this script fire? Does it loop until it has assigned any player that joins a plot or is it fired when something is activated?
It's hard to figure out the problem or write a script that you could adapt when we can't see the full script
Maybe this helps?
for i, v in pairs(game.Workspace.Plots:GetChildren()) do if v.ClaimDoor.Rig.Rig.OwnerName.Value == "" then -- Empty Plot v.ClaimDoor.Rig.Rig.OwnerName.Value = Plr.Name Plr.Character.HumanoidRootPart.CFrame = v.PrimaryPart.CFrame end end