Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Humanoid is not a valid member of Script?

when i run the script i get a error where it says that humanoid is not a vaild member of script

heres the code

##Script:

local Player = game.Players.LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = char.Humanoid

local fire = Instance.new("Fire") -- making fire
fire.Parent = script.Parent -- putting it in the parent
fire.Heat = 10
fire.Size = 4

for i = 1, 100 do
	script.Parent.Players.Humanoid:TakeDamage(0.1) -- making the player take damage
	wait(0.1)
end

fire:Destroy() -- removing the fire and the script
script:Destroy()

1 comment

1

Can you post your script?

1 answer

Well did you try getting the humanoid value like this?

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local Humanoid = char.Humanoid

if so then I don't know because I am a beginner scripter.

2 comments

0

now i have a error saying attempt to index nil with 'Character'

0

yea, that'll only run in a localscript

This discussion is preserved as it was. New answers, comments, and votes are closed.