I made a Text button and put a local script inside which disables a Film Grain local script in Starter GUI when clicked.
What is the issue?
The local script is working and disabling the Film Grain script but the film grain effect is not disabling. I mean that the Script is being disabled but the effect is still there even when the script is disabled.
What solutions have you tried so far?
I’ve found a script from Developer Hub but still, the film grain effect is not disabling but the script is disabled.
SCRIPT WHICH IS USED TO DISABLE THE FILM GRAIN SCRIPT:
local FilmGrain = game.StarterGui.FilmGrain
local textButton = script.Parent
-- Initialize the state of the button
textButton.Text = "Turn OFF Film Grain effect!"
textButton.Font = "Code"
local function onActivated()
FilmGrain.Disabled = true
end
-- Connect the "Activated" event to our function
textButton.Activated:Connect(onActivated)
It is working but since you put game.StarterGui.FilmGrain. it will only disable the script in StarterGui. Try using the PlayerGui in client
local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local FilmGrain = playerGui.FilmGrain
local textButton = script.Parent
-- Initialize the state of the button
textButton.Text = "Turn OFF Film Grain effect!"
textButton.Font = "Code"
local function onActivated()
FilmGrain.Disabled = true
end
-- Connect the "Activated" event to our function
textButton.Activated:Connect(onActivated)
Edit: i forgot to put some things of in the script