Hi, I'm trying to make my pointlight work so that whenever someone says a colour, it changes. It works with the parts, but not the pointlight.

local admins = {
	["Tyxgo"] = "Admin";
	["Cuty2828"] = "Admin";
	["ilikepizzatheking"] = "Admin";
}

local collectionService = game:GetService("CollectionService")
local getTagged = collectionService:GetTagged("BlueBrick")
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.8,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0)

game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if admins[plr.Name] then
			if string.lower(msg) == "black" then
				for i, v in pairs(getTagged) do
					if v:IsA("Part") then
						tweenService:Create(v,tweenInfo,{Color = Color3.new(0, 0, 0)}):Play()
					end
				end
			elseif string.lower(msg) == "blue" then
				for i, v in pairs(getTagged) do
					if v:IsA("Part") or v:IsA("PointLight") then
						tweenService:Create(v,tweenInfo,{Color = Color3.new(0.113725, 0, 1)}):Play()
					end
					if v:IsA("PointLight") then
						v.Color = Color3.fromRGB(255,0,0)
					end
				end
			end
		end
	end)
end)

3 comments

0

why are you tweening pointlight when it does so without a tween anyway?

0

you should use a generalized function for all colors instead of inconsistency

0

i'm not tweening a point light - i'm tweening parts, i just forgot to remove "or v:IsA("PointLight")". do u have a possible solution for this?