For some reason when I use:
game.Players.LocalPlayer.Character:WaitForChild("HumanoidRootPart").CFrame
It gives me an error.
And when I print the Character it comes back as nil
PS: It is in a localscript
Thanks in advance to anyone who can help
1 Like
Nevermind, for some reason It doesn’t work in ReplicatedFirst, and I had the script there; sorry if I wasted your time if you saw this.
1 Like
It works in ReplicatedFirst, the problem is that you’re not waiting for the character to be added. ReplicatedFirst replicates the instances in there first- thus why it is failing to find your character as it has not loaded by that time.
You can add the following to wait for the player’s character:
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()