Androi_D17
(Androi_D17)
August 30, 2021, 12:27am
#1
Some basic stuff problems but I seriously cant figure out why it shows me “character index nil”.
Here the code
local Player = game.Players.LocalPlayer
local hmrp = Player.Character:WaitForChild("HumanoidRootPart")
Thanks for helping and I wish you all best!
ItsSovxy
(Sovxy)
August 30, 2021, 12:31am
#2
Try:
local Character = Player.Character or Player.CharacterAdded:Wait()
local hmrp = Character:WaitForChild("HumanoidRootPart")
dr3wseph
(drew)
August 30, 2021, 12:32am
#3
What this means is that the character is nil, I would do
local Character = Player.Character or Player.CharacterAdded:Wait()
Or what you could do is have this on the first line of code.
wait(math.random())
This way when the character is indexed it wont be nil because the character will be ingame
Androi_D17
(Androi_D17)
August 30, 2021, 12:35am
#4
The issue was that I put the script in the wrong place.
But now my print(Vector…) doesnt seem work
IlasTv
(Boat)
August 30, 2021, 12:35am
#5
You cant access player character through a server script. Through you could do try using ‘chr = script.Parent’ and printing it out like ‘print(chr.Name)’ and see if it works.
1 Like
Androi_D17
(Androi_D17)
August 30, 2021, 12:37am
#6
The issue is away but now my “print” doesnt work,
IlasTv
(Boat)
August 30, 2021, 12:38am
#7
does it print out your character name or it just gives you an error?
1 Like
Androi_D17
(Androi_D17)
August 30, 2021, 12:39am
#8
It just prints nothing. Look, I put the script the script in StarterPlayerScripts and it seems work there. But it doesnt seem working to print my Vector Position after I got no error.
Androi_D17
(Androi_D17)
August 30, 2021, 12:41am
#9
Oh thanks I just realize its a script instead of a local script