I made a game script but the players don't get teleported to game? Please help! The script is the part that doesn't work. Code doesn't get executed after the teleport script
local MapList = Maps:GetChildren() local SelectedIndex = math.random(1,#MapList) local ChosenMap = MapList[SelectedIndex]:Clone() ChosenMap.Parent = workspace wait(10) Sheriffs = Players:GetPlayers() -- Gets all sheriffs local PlayerIndex = math.random(1,#Sheriffs) local JuggernautPlr = Sheriffs[PlayerIndex] table.remove(Sheriffs,findIndex(Sheriffs,JuggernautPlr)) for i,v in pairs(Sheriffs) do local NewGun = Gun:Clone() NewGun.Parent = v.Backpack local GameTag = Instance.new("StringValue") -- Used to see if they are in game GameTag.Name = "GameTag" GameTag.Parent = v.Character local Humanoid = v.Character:WaitForChild("Humanoid") local SpawnIndex = math.random(1,#AllSpawns) local ChosenSpawn = AllSpawns[SpawnIndex] Humanoid:MoveTo(ChosenSpawn.Position+Vector3.new(0,3,0)) -- This doesn't work! table.remove(AllSpawns,findIndex(AllSpawns,ChosenSpawn)) end
you should use;v.Character.HumanoidRootPart.CFrame = CFrame.new(ChosenSpawn.CFrame)+CFrame.new(0,3,0)
;
however;keep in mind that there could be other factors that influenced it to not work; such as v.Character
being nil
, so you might want to use defensive programming to avoid errors;
in case it doesn't work again, press f9 to check the developer console for errors