StunTime is not a valid member of model

Hello, stuntime is a variable that determines how long a player or npc should be stunned for, and even though i’ve put “StunTime” into the model, it still returns an error.
image
image
image
I really dont understand why the error occurs.

i’m not sure if it’ll fix the error but i noticed you didn’t set the value at humanoid.Parent.StunTime = 0.5 and you should probably wait for the value, so maybe try this: humanoid.Parent:WaitForChild("StunTime").Value = 0.5

1 Like

this for some reason worked, (not the .value thing i just tried over and over different stuff, the soloution was WaitForChild)

1 Like

Yeah I think that’s because you were modifying the value before being created (it often happens with characters)

1 Like

Ah, thanks for the explanation. I didn’t really understand anything, and why it was happening. Also, i didn’t have time to go trough 400 lines of code to fix this error, so thank god this was the issue.

1 Like

Your first suggestion is what fixed his error, he was attempting to set the instance itself to 0.5 as opposed to the “Value” property of the instance to 0.5.

1 Like

The error wasnt trying to set a instance to a number, it was it not being found when being indexed.

Remove the .Value in the script, I guarantee it won’t work.

What he meant is that the error he got first

[StunTime is not a valid member of model

was about the Instance not being found

Yeah, once that was fixed the other issue would’ve occurred, fortunately you picked up on both.

1 Like

well, i just forgot .Value that was all really, i would’ve realised when i saw the second error.