Im trying to save data but the game is thinking my humanoid root part is nil when im still ingame
game.ReplicatedStorage.Remotes.DespawnCharacter.OnServerEvent:Connect(function(player)
warn(player.Parent)
local Character = player.Character
local ConvertedThing = Instance.new("StringValue")
ConvertedThing.Value = character.HumanoidRootPart.CFrame.X,character.HumanoidRootPart.CFrame.Y,character.HumanoidRootPart.CFrame.Z
print(ConvertedThing.Value)
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
This solution works because it uses ternary operators in order to get the character. It notices that Player.Character is nil, so it uses the right-hand assignment instead which waits for the character.