Hello, recently I have had an error in one of my scripts on my ROBLOX game named oof simulator that hasn’t been released on the ROBLOX website yet, I was wondering if anybody could fix the error found in my script, since I can’t find it.
Here’s the screenshot:
local enabled = false
script.Parent.MouseButton1Click:Connect(function()
if enabled = false then
enabled = true
change gui text
else
enabled = false
change gui text
end
end)
Try this, it is preferable to use a variable to keep track of whether or not something is enabled instead of text like @Xemptia said, but another issue is you’re using StarterGui instead of the player’s PlayerGui.
local player = game:GetService("Players").LocalPlayer
local playerGUI = player:WaitForChild("PlayerGui")
local enabled = false
script.Parent.MouseButton1Click:Connect(function()
if enabled then
playerGUI.Settings.SettingsGui.OofGuiOnRightSetting.Text = "Oof Gui On Right: Off"
playerGUI.OofSounds.AllOofSoundsLeft.Visible = true
playerGUI.OofSounds.AllOofSoundsRight.Visible = false
else
playerGUI.Settings.SettingsGui.OofGuiOnRightSetting.Text = "Oof Gui On Right: On"
playerGUI.OofSounds.AllOofSoundsLeft.Visible = false
playerGUI.OofSounds.AllOofSoundsRight.Visible = true
end
enabled = not enabled
end)