A recent issue with my ROBLOX script that I made

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:

  • Solved
3 Likes

there’s an extra end, just remove one, and put the else and if together with no spaces.

1 Like

Yeah ^ Also do this instead

local Enabled = false

if Enabled == false 
 Enabled = true
else 
 Enabled = false
end
1 Like

You can change the text by the way ^

1 Like

Whenever I remove an end, it marks the ) at the end with a red underline.
Putting the else and the if together also didn’t work either.

1 Like

There’s also no “enabled” check box in the properties of the frame, the only checkbox that replaces it is the “visible” checkbox.

1 Like

Do what I told you to do and also ENABLED is a local variable and remove the if statement and put the 3 lines of code into the thing for else okay?

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)

Do the rest.

Here’s my music script tho, and its a different version than yours and it still works correctly:

It’s because he said remove the extra end the person above ^^^

What end, there’s 3 end’s in the music script and the other script, I also said:

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)

Oh yeah your right and thanks for telling him about my method.

It worked, thanks, now I can post the beta version of my game!