[SOLVED] Humanoid being nil even after doing checks on previous line

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to set some properties of a function’s parameter which is a humanoid on the server in a modulescript

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that the humanoid seems so be nil even after doing previous line checks

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried to print the humanoid object and it printed humanoid but it didn’t solve anything

function module.FunctionName(hum, data) 
     --even if i do "if not hum then return end" the humanoid when printed exists, but when trying to modify its nil
     print(hum) -- Prints "Humanoid"
      hum.WalkSpeed = data.WalkSpeed or 16
      hum.JumpPower = data.JumpPower or 50
      hum.AutoRotate = data.AutoRotate or true
    --some other code
end

Help is appreciated!

Are the errors things like Attempt to index nil with ‘WalkSpeed’? It might be that data is nil, not the humanoid.

1 Like

yes they are
(charslimitsssssss)

ooh wait it could be (charslimits)

it was thank you rlly much apparently i should have done data and data.WalkSpeed or 16

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.