Visible Script Isn't Working

Hello! So I’m trying to make a computer simulation for a Job Interview Game cald Ro-Works!

I’m currently making computer icons n’stuff!

Weirdly theirs no error! Here’s the script!

local Error_Frame = script.Parent.Parent.Error_Frame

script.Parent.MouseButton2Click:Connect(function()
	Error_Frame.Visible = true
end)

I haven’t seen any errors!

Here is the Game Explorer and Other Infromation!

1 Like

If the script is “CloseScript” change the ‘Error_Frame’ variable to:

local Error_Frame = script.Parent.Parent.Parent

Or if the script is “ShowErrorScript” Change
the ‘Error_Frame’ variable to:

local Error_Frame = script.Parent.Parent

change it to MouseButton1Click, as button 1 is left click, button 2 is right click.

1 Like

I check the code, and it can be the errors:

MouseButton1Click is for left and the MouseButton2Click is right

Try use this scripts:

local Error_Frame = script.Parent.Parent.Error_Frame

script.Parent.MouseButton1Click:Connect(function()
	Error_Frame.Visible = true
end)

or

local Error_Frame = script.Parent.Parent.Error_Frame

script.Parent.MouseButton2Click:Connect(function()
	Error_Frame.Visible = not Error_Frame.Visible
end)

If it no work contact roblox because it can be a @Roblox error, if its a roblox error u cant do nothing!

1 Like

Is their a way I can make it so the player has to click MouseButton1 2 times? this is so that the player can have a more realistic feel and have a more computer like feel when their going to a application

Yes do it:

local Error_Frame = script.Parent.Parent.Error_Frame

script.Parent.MouseButton2Click:Connect(function()
	Error_Frame.Visible = not Error_Frame.Visible
end)

script.Parent.MouseButton1Click:Connect(function()
	Error_Frame.Visible = not Error_Frame.Visible
end)

No not like that, I mean you have to click the button 2 times with the MouseButton1 for it to show up.

1 Like

Now I understand what you need to know.

Have you heard of tick()? It returns the number of seconds since January 1, 1970.
This is very useful for performing those things where if you are not fast enough to do this twice, as a combo in a sword game for example, then that resets.

Here is how to use it:

local DoubleClickDuration = 0.7 --Seconds
local Clicked = 0 --Clicked 0 times
local CurrentTime = tick()

function Clicked()
  CurrentTime = tick() -- Returns the amount of time since January 1, 1970.
--Note: Don't use a local on current time in this function as the next time the functions repeats, that old value in the previous function attempt will NOT change and clicks will reset indefinitely. 
  if Clicked >= 2 then
      --Open the file
  else
     --Hurry and click one more time before it resets.
  end
  wait(DoubleClickDuration) --Wait is for adding a duration, even if this function repeats again, the current time will reset and will not meet the standards for the condition below, thus not reseting the click amount.
  if tick() - CurrentTime >= DoubleClickDuration then --Too bad, you are too slow.
     Clicked = 0
  end
end)

Any Questions about the example?

3 Likes

@Minecrablox Fix it, give he the solution if it works :slightly_smiling_face: