How i can fix this "nil" value?

Hello!

I’m working on a good way to find a player magnitude and comparing it with a part magnitude via RemoteFunctions and RemoteEvents, the problem is, a function keeps marking as nil, but i think i did it ok

Here is my problem:

local BallOwner = Hit:GetNetworkOwner()

local OwnerValue = workspace.Magnitudes:FindFirstChild(BallOwner.Name).Value

The Variable “Hit” is inside a function:

Event1.OnServerEvent:Connect(function(Player,Hit,CanReact,DoesBubble)

For some reason i can’t know yet, when the player fires the event it marks as nil with this error:

¿Why i have this error? ¿How do i can fix it without ruining the script?

Check to see if BallOwner exists before calling FindFirstChild on it.

if BallOwner then
--//input code here
end
1 Like

Thank you, it worked! [30 Chars]

1 Like