When Im using MouseButton1Click its not working

sorry, i spelled it wrong
it should be

MouseButton1Click

the event is misspelled try to write it correctly

I did not notice this

This text will be blurred

Sadly no output

This text will be blurred

Can i see your script once again? (Current)

hey use MouseButton1Click since that’s how it works for you

local Buttons = Menu.Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
	print("In Function")
end)

local UIbutton = Buttons.Cash.Button

function name()
	print("WORKED")
end

UIbutton.MouseButton1Click:Connect(name)


print("After function")
Buttons.Cash.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Cash.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
```
The complete full script:
```
local Menu = game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain
local MenuButton =  game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneHUD.Menu.Frame.ImageButton

MenuButton.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneHUD.Menu.Frame.ImageButton:TweenSize(
		UDim2.new(0.449, 0,2.306, 0),
		"Out",
		"Quad",
		.1,
		true
	)
end)

MenuButton.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneHUD.Menu.Frame.ImageButton:TweenSize(
		UDim2.new(0.385, 0,1.977, 0),
		"Out",
		"Quad",
		.1,
		true
	)
end)

local PhoneIsOpen = false

MenuButton.MouseButton1Click:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseClick:Play()
	if PhoneIsOpen == false then
		PhoneIsOpen = true	
		if game:GetService("UserInputService").TouchEnabled == false then
			game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
				UDim2.new(0.09, 0,0.72, 0),
				"Out",
				"Quad",
				.2,
				true
			)	
			game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
				UDim2.new(-0.27, 0,0.975, 0),
				"Out",
				"Quad",
				.2,
				true
			)
		end
		if game:GetService("UserInputService").TouchEnabled == true then
			game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
				UDim2.new(0.15, 0,0.55, 0),
				"Out",
				"Quad",
				.2,
				true
			)
			game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
				UDim2.new(-0.4, 0,0.495, 0),
				"Out",
				"Quad",
				.2,
				true
			)
		end
	else
		PhoneIsOpen = false
		if game:GetService("UserInputService").TouchEnabled == false then
			game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
				UDim2.new(0.09, 0,9, 0),
				"Out",
				"Quad",
				.2,
				true
			)
			game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
				UDim2.new(0.005, 0,0.975, 0),
				"Out",
				"Quad",
				.2,
				true
			)	

		end
		if game:GetService("UserInputService").TouchEnabled == true then
			game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
				UDim2.new(0.15, 0,1.7, 0),
				"Out",
				"Quad",
				.2,
				true
			)
			game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
				UDim2.new(0.008, 0,0.495, 0),
				"Out",
				"Quad",
				.2,
				true
			)
		end
	end
end)

game:GetService("UserInputService").InputBegan:Connect(function(Key)
	if Key.KeyCode == Enum.KeyCode.M then
		if PhoneIsOpen == false then
			PhoneIsOpen = true	
			if game:GetService("UserInputService").TouchEnabled == false then
				game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
					UDim2.new(0.09, 0,0.72, 0),
					"Out",
					"Quad",
					.2,
					true
				)	
				game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
					UDim2.new(-0.27, 0,0.975, 0),
					"Out",
					"Quad",
					.2,
					true
				)
			end
			if game:GetService("UserInputService").TouchEnabled == true then
				game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
					UDim2.new(0.15, 0,0.55, 0),
					"Out",
					"Quad",
					.2,
					true
				)
				game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
					UDim2.new(-0.4, 0,0.495, 0),
					"Out",
					"Quad",
					.2,
					true
				)
			end
		else
			PhoneIsOpen = false
			if game:GetService("UserInputService").TouchEnabled == false then
				game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
					UDim2.new(0.09, 0,9, 0),
					"Out",
					"Quad",
					.2,
					true
				)
				game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
					UDim2.new(0.005, 0,0.975, 0),
					"Out",
					"Quad",
					.2,
					true
				)	

			end
			if game:GetService("UserInputService").TouchEnabled == true then
				game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
					UDim2.new(0.15, 0,1.7, 0),
					"Out",
					"Quad",
					.2,
					true
				)
				game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
					UDim2.new(0.008, 0,0.495, 0),
					"Out",
					"Quad",
					.2,
					true
				)
			end
		end
	end
end)


game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain.ButtonClose.MouseButton1Click:Connect(function()
	PhoneIsOpen = false
	if game:GetService("UserInputService").TouchEnabled == true then
		game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
			UDim2.new(0.15, 0,1.7, 0),
			"Out",
			"Quad",
			.2,
			true
		)
		game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
			UDim2.new(0.008, 0,0.495, 0),
			"Out",
			"Quad",
			.2,
			true
		)
	end
	if game:GetService("UserInputService").TouchEnabled == false then
		game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain:TweenPosition(
			UDim2.new(0.09, 0,9, 0),
			"Out",
			"Quad",
			.2,
			true
		)
		game.Players.LocalPlayer.PlayerGui.MainGUI.LeftMain:TweenPosition(
			UDim2.new(0.005, 0,0.975, 0),
			"Out",
			"Quad",
			.2,
			true
		)	

	end
end)
print("Beffore Function")
local Buttons = Menu.Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
	print("In Function")
end)

local UIbutton = Buttons.Cash.Button

function name()
	print("WORKED")
end

UIbutton.MouseButton1Click:Connect(name)


print("After function")
Buttons.Cash.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Cash.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Cash.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Cash.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Codes.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Codes.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Codes.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Codes.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Emotes.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Emotes.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Emotes.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Emotes.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Modes.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Modes.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Modes.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Modes.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Rewards.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Rewards.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Rewards.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Rewards.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Settings.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Settings.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Settings.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Settings.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Shop.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Shop.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Shop.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Shop.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.SpawnVehicles.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.SpawnVehicles.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.SpawnVehicles.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.SpawnVehicles.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

Buttons.Teams.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Teams.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)
Buttons.Teams.Button.MouseLeave:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Teams.Button:TweenSize(
		UDim2.new(1, 0,1, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)

it worked on me


maybe there is something wrong with the rest of your script

Hey, who knows what line 226 is?

?

This text will be blurredgggggggggggggggggggggggggggggggggggggggggggg

i will try with the rest of script but it will take a long time

can you show me your explorer tab too?

You know that the number of lines appears in the script, which tells you where the error is, you must say it

Screenshot 2023-01-27 171111

Try fixing your variable in the first line, i don’t see menu variable thingy everywhere

local Buttons = Menu.Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
	print("In Function")
end)

Maybe should be more like this

local Menu = nil -- replace the nil with the location of "Menu"
local Buttons = **Menu** .Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
print(“In Function”)
end)

If you don’t understand, read the script below this text (it’s bold, so you can find it easier)

local Buttons = Menu.Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
print(“In Function”)
end)

Maybe should be more like this

local Menu = nil – replace the nil with the location of “Menu”
local Buttons = Menu .Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
print(“In Function”)
end)

many people have already told you what the error is and it was found out it was because you showed the output, and in the first place when you showed the script you didn’t show it completely you can’t wait for people to ask you

I’m honestly confused on why none of these things are working.

YOU MUST SHOW AT LEAST ONCE WHAT THE DAMN LINE 226 IS IF YOU DON’T SAY NOBODY CAN SOLVE IT FOR YOU. can you show it?

That “menui” thing is unknown

image
maybe you dont show us THE REST of the script
sorry caps : O

1 Like
local Menu = game.Players.LocalPlayer.PlayerGui.MainGUI.PhoneMain
local Buttons = Menu.Apps.Home.Apps

Buttons.Emotes.Button.MouseButton1Click:Connect(function()
	print('In Function')
end)

local UIbutton = Buttons.Cash.Button

function name()
	print("WORKED")
end

UIbutton.MouseButton1Click:Connect(name)

print("After function")
Buttons.Cash.Button.MouseEnter:Connect(function()
	game.Players.LocalPlayer.PlayerGui.Sounds.MouseHover:Play()
	Buttons.Cash.Button:TweenSize(
		UDim2.new(1.2, 0,1.2, 0),
		"Out",
		"Quad",
		.2,
		true
	)	
end)