So I am making a game with levels and each level has a spawn. I don't want to have to use teams and stuff so I wanted to make a custom spawn system but when the player spawns it they just spawn in the middle of the map and their position doesn't change. I checked with a print to see if coordinates were actually given, and there was so I have no idea why this isn't working.
I tried asking in the scripting forum on Roblox and no one helped me so I am hoping one of you guys will
game.Players.PlayerAdded:connect(function(player) player.Team = game.Teams.Grassland local Level = Instance.new("StringValue", player) Level.Value = "G1" player.CharacterAdded:connect(function() player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(workspace.Spawns:FindFirstChild(Level.Value).Position.X, workspace.Spawns:FindFirstChild(Level.Value).Position.Y + 2.55, workspace.Spawns:FindFirstChild(Level.Value).Position.Z)) end) end)
Try this,
game.Players.PlayerAdded:Connect(function(player) player.Team = game.Teams.Grassland local Level = Instance.new("StringValue", player) Level.Value = "G1" player.CharacterAdded:Connect(function(character) wait() character.HumanoidRootPart.CFrame = workspace.Spawns:FindFirstChild(Level.Value).CFrame end) end)
You can't insert a Vector3 position inside a CFrame