So I'm trying to make code that will make a part point towards the cursor, and during this i ended up messing with remote events since i needed those to port over info on where the mouse is. The issue is i also want to port over the HumanoidRootPart of the player and it keeps coming up with this error message. I can't figure out what the problem is
I searched it and i know that the error message is about it indexing something that doesn't exist but it DOES exist so i'm confused
Anyone able to help?
(I started scripting yesterday so i expect this to be a really stupid mistake)
#Attempt to index Nil with 'FindFirstChild'
1 messages · Page 1 of 1 (latest)
** You are now Level 1! **
coolio
If this script is in StarterPlayerScripts, you need to wait for the character, as they may not have one when the code runs.
You're correct it is.
How do i wait for the character?
local c = plr.Character or plr.CharacterAdded:Wait()
if there is you just get it, if not, you'll wait for the signal
local character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
ty
oh...
yeah im dumb
that was in the original code i read and i thought it wasn't important
as i thought this code is not what i'm supposed to be doing
icl i suck at scripting 💔
whatcha making?
use waitforchild