How do I fix my settings script?

My settings script has some options that don’t work and I don’t really know how to make them work, I’m not very good at scripting, so please explain things like you were to a kid or something. The options that don’t work are: preventing blur effects, which players will be visible and keybind change.

Preventing blur effects part: ```
SettingsMenu.SettingsScrollFrame.PreventBlurButton.MouseButton1Click:Connect(function()
local BlurSearch = game.Lighting:FindFirstChildWhichIsA(“BlurEffect”)

if SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text == "Prevent Blur Effects: OFF" then
	if BlurSearch.Enabled then
		BlurSearch.Enabled = false
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = SelectedColor
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: ON"
	else
		warn("No BlurEffect found!")
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = SelectedColor
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: ON"
	end
end
if SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text == "Prevent Blur Effects: OFF" then
	if not BlurSearch.Enabled then
		BlurSearch.Enabled = true
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = UnselectedColor
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: OFF"
	else
		warn("No BlurEffect found!")
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = UnselectedColor
		SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: OFF"
	end
end

end)


Player visibility part: ```SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Sounds.Select:Play()
	for i, OtherPlayer in pairs(OtherPlayers) do
		if OtherPlayer ~= LocalPlayer then
			local Character = OtherPlayer.Character
			if Character then
				local BodyParts = Character:GetDescendants()
				
				if BodyParts:IsA("BasePart") or Character:IsA("Decal") then
					if not OrignalTransparency[BodyParts] then
						OrignalTransparency[BodyParts] = BodyParts.Transparency
					end
					
					BodyParts.Transparency = 0
				else
					if OrignalTransparency[BodyParts] then
						BodyParts.Transparency = OrignalTransparency[BodyParts]
						OrignalTransparency[BodyParts] = nil
					end
				end
			end
		end
	end
	
	SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.BackgroundColor3 = SelectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.FriendsOnly.BackgroundColor3 = UnselectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.NoPlayers.BackgroundColor3 = UnselectedColor
end)

SettingsMenu.SettingsScrollFrame.SeePlayers.FriendsOnly.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Sounds.Select:Play()
	for i, OtherPlayer in pairs(OtherPlayers) do
		if OtherPlayer ~= LocalPlayer then
			local Character = OtherPlayer.Character
			if Character then
				local BodyParts = Character:GetDescendants()

				if BodyParts:IsA("BasePart") or Character:IsA("Decal") then
					if OtherPlayer:IsFriendsWith(LocalPlayer) then
						if not OrignalTransparency[BodyParts] then
							OrignalTransparency[BodyParts] = BodyParts.Transparency
						end
						
						BodyParts.Transparency = 0
					else
						BodyParts.Transparency = 1
					end
				else
					if OrignalTransparency[BodyParts] then
						BodyParts.Transparency = OrignalTransparency[BodyParts]
						OrignalTransparency[BodyParts] = nil
					end
				end
			end
		end
	end
	
	SettingsMenu.SettingsScrollFrame.SeePlayers.FriendsOnly.BackgroundColor3 = SelectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.NoPlayers.BackgroundColor3 = UnselectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.BackgroundColor3 = UnselectedColor
end)

SettingsMenu.SettingsScrollFrame.SeePlayers.NoPlayers.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.Sounds.Select:Play()
	for i, OtherPlayer in pairs(OtherPlayers) do
		if OtherPlayer ~= LocalPlayer then
			local Character = OtherPlayer.Character
			if Character then
				local BodyParts = Character:GetDescendants()

				if BodyParts:IsA("BasePart") or Character:IsA("Decal") then
					BodyParts.Transparency = 1
				else
					warn("")
				end
			end
		end
	end

	SettingsMenu.SettingsScrollFrame.SeePlayers.NoPlayers.BackgroundColor3 = SelectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.FriendsOnly.BackgroundColor3 = UnselectedColor
	SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.BackgroundColor3 = UnselectedColor
end)```

The keybind change part of the script was deleted and I don't have backups to when it was still there, sorry

Hey! I’m not 100% sure of what you are asking, but I took a look at your script and I can help explain what’s going wrong and how to kinda fix it.

  1. Preventing Blur Effects:
  • It looks like the issue here is in the way the script checks the blur effect. The toggle is a bit messy because both conditions check for the same state, and there’s no proper handling for when there’s no BlurEffect in the game.
  • Here’s a cleaned-up version of your script that should work better:
SettingsMenu.SettingsScrollFrame.PreventBlurButton.MouseButton1Click:Connect(function()
    local BlurSearch = game.Lighting:FindFirstChildWhichIsA("BlurEffect")

    if not BlurSearch then
        warn("No BlurEffect found!")
        return
    end

    if SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text == "Prevent Blur Effects: OFF" then
        BlurSearch.Enabled = false
        SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = SelectedColor
        SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: ON"
    else
        BlurSearch.Enabled = true
        SettingsMenu.SettingsScrollFrame.PreventBlurButton.BackgroundColor3 = UnselectedColor
        SettingsMenu.SettingsScrollFrame.PreventBlurButton.Text = "Prevent Blur Effects: OFF"
    end
end)

This version first checks if there’s a blur effect, and then toggles the state cleanly.

  1. Player Visibility:
  • For the visibility toggle part, it looks like the array OtherPlayers isn’t defined, so that needs to be fixed. Also, the check for body parts wasn’t quite right (checking Character:IsA("Decal")), so we should only check if it’s a BasePart.
  • Here’s a cleaner version of the All Players option:
SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.Sounds.Select:Play()

    for i, OtherPlayer in pairs(OtherPlayers) do
        if OtherPlayer ~= LocalPlayer then
            local Character = OtherPlayer.Character
            if Character then
                local BodyParts = Character:GetDescendants()

                for _, part in ipairs(BodyParts) do
                    if part:IsA("BasePart") then
                        part.Transparency = 0  -- Make visible
                    end
                end
            end
        end
    end

    -- Update button colors
    SettingsMenu.SettingsScrollFrame.SeePlayers.AllPlayers.BackgroundColor3 = SelectedColor
    SettingsMenu.SettingsScrollFrame.SeePlayers.FriendsOnly.BackgroundColor3 = UnselectedColor
    SettingsMenu.SettingsScrollFrame.SeePlayers.NoPlayers.BackgroundColor3 = UnselectedColor
end)

Make sure you define OtherPlayers correctly as well!

I can’t exactly help with your keybind stuff but here’s an example:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end
    
    if input.KeyCode == Enum.KeyCode.F then  -- Example: Change keybind to "F"
        -- Trigger some function or change keybinding
        print("F key pressed!")
    end
end)
1 Like

Thanks alot for helping me, I can’t see if the players one works at the moment but either way this really helped me

1 Like

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