How can i put a function in an if statement?

hello ive experienced an issue with my game, i was trying to put a function in a if then statement such as the following

i want to make it so if the number is 1 AND the player clicked the button then this if statement will fire

noted that I need to make the function in the line of the if then not inside or outside the if statement

local Num = 1 

local Player = game.Players.LocalPlayer

while wait(0.001) do

if Num == 1 and mouse.Button1Down:Connect(function() then

 -- whatever code 

end
end
local Num = 1

game:GetService("UserInputService").InputBegan:Connect(function(Input, Processed)
	if (Input.UserInputType == Enum.UserInputType.MouseButton1) and (not Processed) and (Num == 1) then 
		--// whatever code
	end
end)
1 Like

appreciate it very much it worked

1 Like

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