Mousebutton1Click/ local function Doesn't Work?

Im trying to make a custom console but my problem is when the player clicked the memory button it will show the user’s memory. but what happen is, it didn’t create any action??

my script:


local function ViewPlayerLogs()
	print("To logs")
	script.Parent.ClientLogs.Visible = true
	script.Parent.MemoryLogs.Visible = false
end
local function ViewPlayerMemory()
	print("To memory")
	script.Parent.ClientLogs.Visible = false
	script.Parent.MemoryLogs.Visible = true
end

script.Parent.Topbar.MemoryButton.MouseButton1Click:Connect(ViewPlayerMemory)
script.Parent.Topbar.LogsButton.MouseButton1Click:Connect(ViewPlayerLogs)

I put print there because to make sure if the mousebutton1click/ local function is working. but it didn’t print any.
Additional

  • no errors like is not a child of that
1 Like

The only reasons I can think that this is not working are:

  1. Are your UIs TextButtons or ImageButtons?
  2. Is there any loop that is stopping the script from getting to the event connection?

I’d suggest doing it my way:

script.Parent.Topbar.MemoryButton.MouseButton1Click:Connect(function()
print("To memory")
script.Parent.ClientLogs.Visible = false
script.Parent.MemoryLogs.Visible = true
end)

Does that work?

it’s a textbutton, and theres no loop that it’s stopping it. its on a single script

Wow! it worked thanks! but the other script suddenly stop which has local function when i put it. also the while do stopped

Change the second function to match my example too.

I knew there is a loop here, uh, is it in the same script? Before or after the functions?


im not sure on what’s your point but this is the last line of script with while do

CTRL + X the whole loop and CTRL + V it after the connections.

1 Like

Wait thank you! i finally fixed the problem on my other game that i can’t solve, its because of while do line! thanks again!

1 Like