Attempt to index "nil" With animation script?

I’ve got a serverscript which enables an animationscript but it doesn’t work for some reason?

GToolModel:GetChildren("GasterBlaster").Skull.AnimationScript.Disabled = false

This is the children of it :

image
Help would be appreciated thank you!

Since the only child of the script is GasterBlasterRing, here’s what you have to do:

script.GasterBlasterRing.GasterBlaster.Skull.AnimationScript.Disabled = false

This is because you can’t identify a model by doing :GetChildren(), rather instead just identify it by what i did

GToolModel is GasterBlasterRing, I wanna get the animationscript of each gasterblaster since there is about 30, I should of shown the entire SS, Is there anyway to get all of them then?

image

Ohh, I understand now. So basically, to do this, you would use a for loop.

Make sure to identify the skull, as it will be easier by doing so:

for i,v in pairs(GToolModel:GetChildren()) do
	if v.Name == "GasterBlaster" then
		for _, obj in pairs(v:GetChildren()) do
			if obj.Name == "Skull" then
				obj.AnimationScript.Disabled = false
			end
		end
	end
end

For loops basically loop through the children of an object, therefore being able to change properties easily that way

1 Like