Script to change state of a light wont work

local Players = game:GetService("Players")
local RS = game:GetService("ReplicatedStorage")
local clct = game:GetService("CollectionService")

Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(chat)
		if chat == "/Builds" and plr.Name == "Vortexuel560" then
			print(chat)
			for _, V in pairs(Workspace.Complex:GetDescendants()) do
				if V:IsA("BasePArt") then
					if clct:HasTag(V, "Window") then
						V.SurfaceLight.Enabled = true
					end
				end
			end
		end
	end)
end)

Im going through a model and seeing if its decendants have a child with a tag called window, if true then turn on that parts surface light.
All the required parts have tags called window, and surface lights.
There are no errors also in the output

you spelt “BasePart” wrong in V:IsA()

bruh no wayyyy, ill fix that and see if it works


yessir it worked, thanks!

no problem lmfao, i actually didnt expect that to be the issue

yeah i would expect an error for mispelling that

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.