Gui doesnt appear on screen when sitting, but only in some games?

I’m currently building a train for a friend’s game, and there’s supposed to be a GUI that pops up when you sit in the drive seat, but for some reason, my gui works in the game in which my model was built, but not in a different game? The script that puts it on the screen is exactly the same, the model is the same, and the gui refuses to move to the PlayerGui, even with use of the console to attempt to move it manually.

image

I’ve used a series of print()s to see if the script was responding, and it did indeed detect when i sat, and also it managed to set the TrainOperator value, and yet the GUI itself just refuses to move.

indepth video of my issue

1 Like


even entering a command in the console doesn’t do anything here.

1 Like

Take a look at your PlayerGui in the game where it doesn’t work, verify that the gui is inside it and check if the .Enabled property is false for some reason. You should be able to mess around at run time to figure out how to get it to show up, or otherwise give clues as to what’s going wrong (i.e. if it’s not in your PlayerGui, then something isn’t working with listening to the event or validating the event)

if all is printing it should be working maybe do a wait on the UI although it should throw an error if its not there…

local Train = script.Parent:WaitForChild(‘TrainGUI’)

or try a task.wait(2) at the top of the script see if that fixes it then you know its something with loading in

it just doesn’t go to playergui at all

nothing in console either too

So work through the series of expected events from beginning to end and figure out where it’s going wrong.

  1. Is the script running? (Put a print at the top of the script)
  2. Is the TrainGUI next to the script? (Print Train to validate it isn’t nil)
  3. Is script.Parent the seat? (Make sure the script is in the seat)
  4. Is the seat.ChildAdded event firing your onChildAdded function? (Print at the start of the function)
  5. Is the child name SeatWeld? (Print in the first if statement)
  6. Is the Part1 name HumanoidRootPart? (Print in the second if statement)
  7. Is the Part1.Parent a character of a valid player? (Print player)
  8. Is player nil? (Print inside the third if statement)

Surely if it’s not working, at least one of these will fail to print an expected value.

i’ve used prints to test for all these, and they all returned

the issue here is that script works in one game, but not another for an unknown reason, without anything at all in the console? i have a feeling this may be a roblox bug

I’m having a hard time understanding how all those can be printing correctly yet the Gui isn’t showing up in your PlayerGui. Can you do another screen recording of this, especially showing the gui showing up in PlayerGui but not being visible to you?

1 Like

notice how print(“E”) appears

image
as mentioned earlier, the gui just straight up doesnt get copied

Ah… perhaps there is an ephemeral duplicate SeatWeld created and removed that is removing the script after being parented. Try adding some prints to the ChildRemoved function as well to see if that’s the case

if a child named seatweld were to be removed, the entire train would delete itself
image

image
interestingly enough, putting a print(child.Name) in says the TrainGUI gets removed from the seat, but no leads as to where it’s gone off to

Perhaps the Train.Parent = script.Parent and script.Parent:SetNetworkOwnershipAuto() should also be inside that if statement.

If you notice in your logs, there’s another A printing, indicating a second child is added. This makes me suspicious that the “other thing” could also be getting removed, which runs your onChildRemoved function, and reparents your script regardless of whether or not it was a SeatWeld

image
adding a Train.Parent.Name print tells me it’s in a playergui, but it just doesnt appear??? i am so confused

oh my god :sob:
i seriously dont know how this slipped me

I’m not sure why the behavior is inconsistent with your original place, though. You could add a print to figure out what that other thing being added is and it might give you a clue, but regardless making the change makes the system more robust and seems to fix the issue :+1:

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