WaitForChild not working

Why does my WaitForChild not working? I’m trying to acess the player’s character, but it says:

Workspace.Rapideed.FireBallscript.Fireball:8: attempt to index nil with 'WaitForChild'
(TheScript is also in PlayerCharacterScripts
Script:

local Player = game.Players.LocalPlayer
local Character = Player.Character

Thank you for reading.

attempt to index nil with ‘WaitForChild’ means you all trying to wait for a child with a parent that doesnt exist

If you are accessing the character within a local script, just do:

local character = game.Players.LocalPlayer.Character

You can’t use “WaitForChild” inside a local script. It generally works in scripts.

Well, yes you can lol
image

are you sure you spelled everything corectly

For other properties, you can. Lemme rephrase:

There are simpler ways to access the players character than using WaitForChild.

1 Like

It says:
Workspace.Rapideed.FireBallscript.Fireball:8: attempt to index nil with ‘Character’

LocalPlayer does not work inside of a Server Script btw

1 Like

What is your local script going to do? What’s its purpose?

use game.Players.PlayerAdded and player.CharacterAdded

I gave you the script on the top.

I can assure you this will not help unless context is provided

You are using a local script right?

Correct and it’s in StarterCharacterScripts

player.Character or player.CharacterAdded:Wait()

Whats the context of the script? What is it supposed to do? This can help us understand if you placed your script in the wrong category or help you make the script.

This is supposed to do damage to the player.

where are you using waitforchild?

If they touch an object or just damage the player without them doing anything?

It’s a projectile. That does damage when touched.