game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) RaceManager.IntermissionStarted:connect(function() local intermissionDuration = RaceManager:GetIntermissionDuration() wait(intermissionDuration / 2) pushPlayerName("RACE STARTING SOON", intermissionDuration / 4) --Random Start Grid Spawn local Spawns = workspace.Game.GridLineUp:GetChildren() local random = Spawns[math.random(1,#Spawns)] --Moves the kart if there is a kart in the workspace to the starting grid local Class = game.Workspace.Game.GameSettings.Class.Value local Kart = game.Workspace.Game.SpawnedGoKarts:FindFirstChild(player.Name.."'s "..Class) repeat for i = 1, #Spawns do if Spawns[i]:FindFirstChild("Occupied").Value == false then do warn("NOT OCCUPIED M8") if (Kart) then Kart:SetPrimaryPartCFrame(random.CFrame + Vector3.new(0,3,1)) warn(player.Name.."'s " ..Class.." has been Moved to a starting grid") else warn("Occupide") end end end end until not Spawns[i]:FindFirstChild("Occupied").Value == false end) end) end) end) end) end)
I cant use ends it seems like ;/
Basically i want it to keep searching for a free spawn place until its found, as when someone spawns there (Occupide) will be true. Like in a racing game telling the script that the player cannot spawn there with the kart.
The not is evaluated first. All you have to do is use parentheses and you are good to go. Here is an example of the until line:
until not (Spawns[i]:FindFirstChild("Occupied").Value == false)
I hope this helps and have a great day scripting!