Hi!
Recently I have been trying to do a Dark Mode. but am failing. Can someone describe these issues?
1: For some reason, not working all together. When activated, it just destroys the settings frame + button. Button:
--5595965685
local btn = script.Parent
local LoadFrame = script.Parent.Parent.Parent.Parent.WarningSettingsDME
LoadFrame.Visible = false
btn.MouseButton1Click:Connect(function()
if LoadFrame.Visible == false then
LoadFrame.Visible = true
LoadFrame.Parent.Parent.Disabled = false
script.Parent.Image = "rbxassetid://5595965685"
script.Parent.Parent.TextLabel1.Text = "Disabled! Click to Re enable."
script.Parent.IfDisabled.Disabled = false
script.Disabled = true
print "Someone turned on Dark Mode!"
end
end)
Main DarkMode Script:
while wait (0.1) do
local t = script.Parent.Parent:GetDescendants()
for _, instance in pairs(t) do
if instance:IsA("Frame") then instance.BackgroundColor3 = Color3.fromRGB(42, 42, 42) end
if instance:IsA("TextLabel") then instance.TextColor3 = Color3.fromRGB(255,255,255) end
end
end
2: How would I use DataStore to find if the player had it enabled. Adn if enabled, enable the script. If not, keep it disabled until they change it via settings.
Personally I wouldnât recommend encasing a loop while attempting to detect changes by every frame, just use the GetPropertyChangedSignal instead for the LoadFrame variable
@IceTheOneAndOnly Surprisingly enough, that works with or without parentheses
Can you check if there are any other scripts that could be destroying the Frame + Button?
I donât know⌠Canât find it nopw because of this aggressive message below
(of course, my ui designer is obsessed with me touching NOTHING UI related, and he deleted it. (if your reading this madden, WHY⌠I SPENT SOME TIME ON THAT >:((( )
This line might be the problem. The frame with the button is being disabled when the script runs, and then when the button is pressed it is enabled again however the button cant be pressed when it is disabled, unless there is another script enabling the frame.
Also, it seems script.Parent is used 4 times in the script, but there is already a âbtnâ variable for it. Rather than using script.Parent every time, it would be more efficient and easier to read if the variable was used instead.