Lines in script randomly not running

So I’m having a problem where the middle two lines of this script are not running. I get both print statements so it makes no sense to me why the middle lines are not running.

image

Screenshot 2022-04-27 185221

I also tested this in the command line and it worked fine, so I have no idea why it’s not working in the script. Does anyone know a potential cause or fix to this? Is it possible for studio files to get corrupeted? I also tried putting the script in a completely new studio file and got the same issue.

(No, there is not any free models in the game.)

Edit: Some RemoteEvents and BindableEvents are failing to work for aboslutely no reason now as well.

1 Like

Is the gui itself enabled? If not then enable it.

1 Like

This did not work. I’m not sure how putting the print statements on the bottom would change anything. Also having a print at the top and the bottom proves the script is moving through those lines.

1 Like

The GUI is enabled. Here is a screenshot of the properties.

1 Like

What is

(PlayerName)

?

1 Like

And the properties of TopMenu?

1 Like


These are the properties of TopMenu. It is supposed to have Visible set to false by default, hence the script setting it to true.

1 Like

local Players = game:GetService(“Players”)

local Player = Players.LocalPlayer

local PlayerName = Players.LocalPlayer.Name

print(PlayerName)

I normally wouldn’t write this way, but I’m trying to get to the bottom of what the issue could be. I thought there could have been an isue with LocalPlayer but clearly this is not the case

1 Like

Is this a local script, module script or script?

1 Like

Can you show us the entire script so that we might be able to understand it better? Specifically, the ‘PlayerName’ variable might help to specify the problem.

It is a local script. The script’s parent is the GUI

Ok so here is what I did. No idea why this works, but this fixed the problem

wait(.1)
topMenu = script.Parent.TopMenu
topMenu.Visible = true

If that worked then it might have been that the frames had not yet loaded in, therefore making the lines not effect anything.

Interesting… I’ve never experienced this bug before. Is there any way to correct this or am I just laggy?

Have you attempted to use the WaitForChild event?

1 Like