Hulp with dark mode zwitch

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    dark mode zwitch for gui work not
  2. What is the issue? Include screenshots / videos if possible!
    nothing hapened
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    searching the dev forum

i will for my plugin made an darkmode zwitch trough colectionservice but he not change the colors from the tagged guis

local colectionservice = game:GetService("CollectionService")

local tag1 = "modezwitchfoodeggs7"

local tag2 = "modezwitchtextfoodeggs7"

local tag3 = "modexwitchuistrfoodeggs7"

local tag4 = "modebackgroundfoodeggs7"

local tag5 = "modetopbarfoodeggs7"

script.Parent.MouseButton1Click:Connect(function()
	if colectionservice:HasTag(game.StarterGui.folder.screengui, "tag1") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag1)) do
			gui.BackgroundColor3 = Color3.fromRGB(217, 217, 217)
		end
	end
	
	if colectionservice:HasTag(game.StarterGui.folder.screengui, "tag2") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag2)) do
			gui.TextColor3 = Color3.fromRGB(0, 0, 0)
		end
	end
	
	if colectionservice:HasTag(game.StarterGui.folder.screengui, "tag3") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag3)) do
			gui.Color = Color3.fromRGB(217, 217, 217)
		end
	end
	
	if colectionservice:HasTag(game.StarterGui.folder.screengui, "tag4") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag3)) do
			gui.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
		end
	end
	
	if colectionservice:HasTag(game.StarterGui.folder.screengui, "tag5") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag3)) do
			gui.Color = Color3.fromRGB(195, 195, 195)
		end
	end
	
	script.Parent.Parent.off.Visible = true
	script.Parent.Parent.on.Visible = false 
end)

what doing i frong i have set my username in the tag so it change not the collors from guis that the user have it is for an plugin

2 Likes

what, im so sorry, im so lost, can you rephrase this, or any errors?

2 Likes

There no errors the script be running good but there happening nothing he not change the colour from the tagged guis.

1 Like

It’s hard to understand exactly what’s happening. Why are you making references to game.StarterGui.folder.screengui?

Either way, the first thing you could do is unquote the tags in lines like this. You don’t need to quote them since the variable contains a string. You’re currently not calling the variables due to them being in quotes here.

Basically, what you’re doing at the moment is checking whether the instance has “tag1”, which isn’t what you want. You want to check whether the instance has “modezwitchfoodeggs7”.

1 Like
Local tag1 = "modezwitchfoodeggs7"
Local Gui = game.startergui.folder.screengui.frame

script.Parent.MouseButton1Click:Connect(function()
	if colectionservice:HasTag(gui, "tag1") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag1)) do
			gui.BackgroundColor3 = Color3.fromRGB(217, 217, 217)
		end
	end

Can it so and the rest from the gui so buttons with that tag

I’m sorry but I can’t quite understand what you’re saying.

Like I’ve said, remove the quotes from tag1 etc in the HasTag functions.

1 Like
script.Parent.MouseButton1Click:Connect(function()
	if colectionservice:HasTag(gui, "zwitchmodefoodeggs7") then 
		for _, gui in ipairs(colectionservice:GetTagged(tag1)) do
			gui.BackgroundColor3 = Color3.fromRGB(217, 217, 217)
		end
	end

How with the Gui before the tag if I destroy that then I get an error with argument 2 is missing or nil

What line is the issue even happening on? I’m sorry to say this, but it’s a real struggle trying to understand you?

I assume you’re having issues with the GetTagged function right? If you’re trying to get the tags of your plugin widget, you might run into issues, since you can’t access plugin widgets easily.

I’m hoping I’m as clear as I can be

1 Like

It works now but does not everything switch with that tag and change it into the starter Gui huis