Duplicate thread

This issue has been posted many many other times therefore I have removed it.

1 Like

Try adding a print statement under player,

print(player.Name.." is the player who touched")

And try adding this;

print(player.PlayerGui.ScreenGui.Frame.Visible)

This is called debugging, and this will tell you if the script is working properly.

1 Like

Does it print true or false after it says the player touched? If not, could you screen shot the GUI ( this includes the name frame ect ) Just like screen shot it in StarterGui.

Change the name of the elevator GUI to something other than ScreenGui, make it ElevatorGUI for example, and then do your script, but change PlayerGui.ScreenGui to ElevatorGui once renamed , you may ask why we are doing this, well if you have several GUI’s named the same thing, the script might get confused and pick a different GUI.

Hmm, I will try it but if that is what is happening then why is it only doing it the FIRST time?

Alright, I tried that but it still only pops up ONCE, it does not pop up again if you back into the elevator.

Because it is confused, and it is picking different GUI’s at random times. I recommend renaming all GUI’s instead of keeping it at “ScreenGui”

Could you provide one of the elevator scripts in the client as a piece of coding example?

Sorry, I don’t know what that is, nor how to do that :confused:

You do not know how to rename a GUI?

No, the second part

“Could you provide one of the elevator scripts in the client as a piece of coding example?”

Simple, just go to the script, copy the code ( go to one of the elevator scripts in the buttons ) and then paste it into a message like this;

image
Also if you do not know how to do this, I recommend checking this thread, to start you off in the Developer Forums :smiley:

DevForum Guide

1 Like

I didn’t know what you meant. Sorry, I know how to do that.

db = false

script.Parent.Touched:connect(function(Hit)
    if db == false then db = true
        local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
        player.PlayerGui.ElevatorGUI.Frame.Visible = true
print(player.Name.." is the player who touched")
print(player.PlayerGui.ElevatorGUI.Frame.Visible)
        wait(2)
        db = false
    end
end)
1 Like

Could you also send one of the button scripts? That is the script for the touching, I noticed you have buttons for elevator levels.

Alright, so I have 9 floors + lobby and each of them are a part and it teleports them to that part here is the script of one of the buttons

script.Parent.MouseButton1Click:Connect(function()
 game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.teleport9.position)
  
end)

Could you supply us with the script responsible for hiding the player gui? I believe the problem lies there.

Instead of your current script, do this;

script.Parent.Touched:Connect(function(Hit)
local player = game.Players:GetPlayerFromCharacter(Hit.Parent)
local GUI = player.PlayerGui:FindFirstChild("ElevatorGUI")
if GUI.Frame.Visible == false then
GUI.Frame.Visible = true
print(player.Name.." is the player who touched")
print(player.PlayerGui.ElevatorGUI.Frame.Visible)
end
end)

For your buttons,

script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.teleport9.position)
--Under every statement to teleport add this;
script.Parent.Parent.Visible = false
end)

Here is the script for hiding it:

script.Parent.MouseButton1Click:Connect(function()
game.Players.LocalPlayer.PlayerGui.ElevatorGUI.Frame.Visible = false
end)

Alright, thank you I will try that.

To make it cleaner, delete the X button and put that visible script I provided under every teleport statement , this will make the GUI disappear every time they teleport.

Alright, thank you I will mark as solution once it works.

1 Like