Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does nothing happen when the value reaches a certain point?

local button= game.Workspace.Monitor.RealScreen.Display.BG.TDIW.WebScrollFrame.ColaWeb
local button1 = game.Workspace.Monitor.RealScreen.Display.BG.WebsiteOne.Topbar.Exit
local hacked = 0

if hacked == 5 then
	print("Hacked")
	hackgui.Visible = true
	hackgui.Parent.BG.Visible = false
end

button.MouseButton1Click:Connect(function()
	hacked = hacked + 1
	print("UpBy1")
	print(hacked)
end)

button1.MouseButton1Click:Connect(function()
	hacked = hacked + 1
	print("UpBy1")
	print(hacked)
end)


1 answer

✓ Accepted answer

This is an easy fix, you should just check hacked number when you click the mouse button. If statements only run once unless repeated.

local button= game.Workspace.Monitor.RealScreen.Display.BG.TDIW.WebScrollFrame.ColaWeb
local button1 = game.Workspace.Monitor.RealScreen.Display.BG.WebsiteOne.Topbar.Exit
local hacked = 0

button.MouseButton1Click:Connect(function()
    hacked = hacked + 1
    print("UpBy1")
    print(hacked)
	if hacked == 5 then
  	  print("Hacked")
 	   hackgui.Visible = true
 	   hackgui.Parent.BG.Visible = false
	end
end)

button1.MouseButton1Click:Connect(function()
    hacked = hacked + 1
    print("UpBy1")
    print(hacked)
if hacked == 5 then
    print("Hacked")
    hackgui.Visible = true
    hackgui.Parent.BG.Visible = false
end
end)


This discussion is preserved as it was. New answers, comments, and votes are closed.