I wanted to create a gui for a door with a picture on it so that when a user touches the door, they get prompted to enter a password to open the door. The password ends up being the description of what the picture represents. I was able to create the functionality quite nicely by using a screen gui. Unfortunately there is a bug where a door sometimes gets triggered through an adjacent wall, which I assume to be a relative closeness issue, however, if my user dies while this happens, then when the user is respawned the screen gui no longer works. This is possibly because the gui is destroyed upon the characters death.
This bug only occurs in a very specific case and not very frequently, however it does happen enough to create a poor user experience.
Part of the resolution I would like to use is to resolve the false door trigger, and the other to check on the character death for the presence of the gui and return it to it’s original position in the workspace hierarchy for later use.
Door.Touched:Connect (function(hit)
if hit.Parent:FindFirstChild ("Humanoid") then -- the rigs touched the part.
char = hit.Parent
elseif hit.Parent.Parent:FindFirstChild("Humanoid") then -- the accessory handle touched the part.
char = hit.Parent.Parent
end
end)
This let’s you know if the one that touched the part was a player.
It’s best practice to reference the player in a function every time you want to use the gui, instead of having it loose in your code. If you showed a bit of how you structured the code I could help point out where the error is
Sorry, I was able to get the gui to appear, the problem is that it appears when it is not supposed to., then if I die in a very specific spot while the gui is showing,when I respawn it does not show anymore.
This is a link to the game, if you can make it to the second floor and go to the right hand side of the wall where there are several kill blocks are on the floor, this may trigger the candle door gui, where if you die while it is showing does not reappear, I suspect that when the player/character is killed the gui is destroyed, when it needs to be put back into its replicated storage location for later reshowing.
I reuse the same gui for multiple doors and swap out the image for the specific door.
But I need to somehow detect this case so that I can protect the gui from seemingly being destroyed and or prevent it from being displayed in the first place in this erroneous way.
You shouldn’t really be expecting us to play-through your game to reach a certain point so that we can observe what issues are taking place. Instead, please provide any scripts you need assistance with and if you’d like, feel free to provide recorded footage of the issues which you are currently facing.
I agree, but in fact, if people do play the game they may better understand what I am speaking about in terms of the issue and may be able to give better advice.