Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont the players be moved to the allocated positions?

Asked by 5 years ago

This works in ("Play")

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")

                        random.Material =("Neon")
                        random:FindFirstChild("Occupied").Value = true

                        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 (random:FindFirstChild("Occupied").Value == false)
        end)
    end)
end)

I think the problem is here

            --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")

                        random.Material =("Neon")
                        random:FindFirstChild("Occupied").Value = true

                        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
0
indent ur code properly eeeeeeeeeeee User#19524 175 — 5y
0
lol, Roblox isnt letting me aleandroblingo -35 — 5y
0
Can you help me? aleandroblingo -35 — 5y

Answer this question