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

GetChildren help to reach a destination?

Hello, thanks for reading.

Error: 17:27:14.449 - Workspace.Meltdown Detector:63: 'end' expected (to close 'function' at line 6) near ''

I am having trouble with GetChildren while getting to the destination.

So, this is part of my script

		local mainframelights = workspace.MainframeLights:GetChildren()
		for i = 1, #mainframelights do
    	mainframelights.Light.PointLight[i].Color = Color3.new(255, 0, 0)
end

And this is my module workspace:

Workspace
	MainframeLights (Module)
		Light (Module)
			Light (Part)
				PointLight (PointLight)
		Light (Module)
			Light (Part)
				PointLight (PointLight)
		Light (Module)
			Light (Part)
				PointLight (PointLight)
		Light (Module)
			Light (Part)
				PointLight (PointLight)
		Light (Module)
			Light (Part)
				PointLight (PointLight)
		Light (Module)
			Light (Part)
				PointLight (PointLight)

Thanks if you helped! :)

1 answer

✓ Accepted answer

Indent your code to find the missing end. Also for:

mainframelights.Light.PointLight[i].Color = Color3.new(255, 0, 0)

Get rid of the [i] it just breaks it.

Switch Color3.new(255, 0, 0) to Color3.new(1, 0, 0) as Color3 is 0-1. (divide by 255 if you want a specific colour)

1 comment

0

Thanks :)

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