local ScreenGui = script.Parent local Var = false ScreenGui.ImageButton1.MouseButton1Down:Connect(function() Var = true end) ScreenGui.ImageButton1.MouseButton1Up:Connect(function() Var = false end) if Var == true then print('Is True') end
It wont work even if i put Var == true then
is there any other solution?
local Gui = script.Parent local Bool = false Gui.ImageButton1.MouseButton1Down:Connect(function() Bool = true end) Gui.ImageButton1.MouseButton1Up:Connect(function() Bool = false end) while true do wait() if Bool then print('babymode') end end
As Fifkee said, it just required a loop.