Random red line under my script

  1. What do you want to achieve?
    I want to make a script that turns my gui off and on when a button gui gets clicked.
  2. What is the issue?
    Theres a red line under script, and Players.Player might not work.
  3. What solutions have you tried so far?
    I’ve tried to google it but it came up with nothing good.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local button = script.Parent

button.MouseButton1Click:Connect(function()
	if game.Players.Player.PlayerGui.Auction.Enabled == false then
		game.Players.Player.PlayerGui.Auction.Enabled = true

		if game.Players.Player.PlayerGui.Auction.Enabled == true then
			game.Players.Player.PlayerGui.Auction.Enabled = false
		end
	end)

You dont have a end statement after first if

Still doesnt work with one end, or am I doing this wrong?

local button = script.Parent

button.MouseButton1Click:Connect(function()
	if game.Players.Player.PlayerGui.Auction.Enabled == false then
		game.Players.Player.PlayerGui.Auction.Enabled = true
        end
		if game.Players.Player.PlayerGui.Auction.Enabled == true then
			game.Players.Player.PlayerGui.Auction.Enabled = false
		end
	end)
1 Like
local button = script.Parent

button.MouseButton1Click:Connect(function()
	if game.Players.Player.PlayerGui.Auction.Enabled == false then
		game.Players.Player.PlayerGui.Auction.Enabled = true

		if game.Players.Player.PlayerGui.Auction.Enabled == true then
			game.Players.Player.PlayerGui.Auction.Enabled = false
		end
    end
end)
local button = script.Parent

button.MouseButton1Click:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Auction.Enabled = not game.Players.LocalPlayer.PlayerGui.Auction.Enabled
end)
1 Like

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