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

Script is not a valid member of Humanoid?

When I run the script, I get an error where it says that: humanoid is not a valid member of script

##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()

Re-edited by JesseSong!

image https://www.linkpicture.com/q/Screenshot-2021-08-04-124957.png

23 comments

0

i dont know how to make this into lua

0

is the script in workspace?

0

no

0

Inside a part?

0

yes

0

its inside a model and its a server script

0

im not that knoledgeable on lua but i think that if its inside there it wont work so you can try to add a function on the event a player joins

0

inside a server script

0

like for example: game.Players.PlayerAdded:Connect(function(player) will create a function called player when the player is added and you can add information into "player"

0

the script is in a server script inside a server script hold on i'm putting a image

0

If the script is in serverscript doing script.Parent.Players wont work because they are sort of siblings for lack of a better term

0

what do i do then? move it to server script service?

0

how do i fix it?

0

No you can maybe move it to Workspace and change "script.Parent" to possibly "script.Parent.Parent" or change it to game.Workspace.Players

0

except im a bit confused where the script really is, where really is the script?

0

i have included a screenshot but which script do i move player damage or the script?

0

whats the script called "script" doing for you?

0

If its a serverscript, there is no LocalPlayer

0
0

the script i making the gaspump explodeable

0

check out JesseSong's response and do it

0

ok

1 answer

✓ Accepted answer

##Problem:

You've already referenced the player, script.Parent You don't need to add script.Parent.Players because the game already knows what you're talking about.

##Solution:

To fix this just remove the .Players in the scripts and you're ready to go!

##Fixed 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.Humanoid:TakeDamage(0.1) -- making the player take damage
	wait(0.1)
end

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

Remember that this has to go in StarterPlayer < StarterCharacterScripts

15 comments

0

@JustinWel12 it depends on what your doing. They are only useful for storing stuff in the player's character

0

yeah and the code too

0

after a few hours of debugging i finally got the script working

0

I'm stuff confused why my script didn't work for you, as it works for me. I think you did something wrong with mine!

0

is your script in the starter player?

0

yes in startercharacterscripts

0

that's strange why its working for me but not you

0

send a screenshot of the code of mine

0

Because in the code you said to remove the .Players all i added back was .Players and moved the script into the players character

0

in script line 1

0

Did you change my script that i wrote or left it?

0

because if you changed my script, then it won't work (as i changed it for you)

0

i did not change your script it should work

0

then why didn't it work for you. you did

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