Hi,
This script I made for a screen works fine apart from after a couple of times of jumping out of the seat and back into the seat, it breaks and I do not receive the GUI. What would be the fix to this?
This is the script;
seat = script.Parent.Seat screen = script.Parent.Screen.Gui.Screen gui = script.Parent.CheckInGui seat.ChildAdded:connect(function(newWeld) character = newWeld.Part1.Parent player = game.Players:GetPlayerFromCharacter(character) if player.Backpack:FindFirstChild("Staff") then guiClone = gui:Clone() guiClone.Parent = player.PlayerGui guiClone.Main.Update.MouseButton1Click:connect(function(update) screen.Class.Text = guiClone.Main.Class.Text screen.Desk.Text = guiClone.Main.Desk.Text screen.Destination.Text = guiClone.Main.Destination.Text end) end end) seat.ChildRemoved:connect(function(removeWeld) screen.Class.Text = "Desk Closed" screen.Desk.Text = "" screen.Destination.Text = "" if guiClone then guiClone:Destroy() end end)
Thanks Kieran
seat = script.Parent.Seat screen = script.Parent.Screen.Gui.Screen gui = script.Parent.CheckInGui seat.ChildAdded:connect(function(newWeld) character = newWeld.Part1.Parent player = game.Players:GetPlayerFromCharacter(character) if player.Backpack:FindFirstChild("Staff") then guiClone = gui:Clone() guiClone.Parent = player.PlayerGui guiClone.Main.Update.MouseButton1Click:connect(function(update) screen.Class.Text = guiClone.Main.Class.Text screen.Desk.Text = guiClone.Main.Desk.Text screen.Destination.Text = guiClone.Main.Destination.Text end) end end) seat.ChildRemoved:connect(function(removeWeld) screen.Class.Text = "Desk Closed" screen.Desk.Text = "" screen.Destination.Text = "" if guiClone then guiClone:Destroy() end end)
At Line 24 guiClone Is Destroyed Meaning That It Could Have Been Completely Destroyed out of the game, I recommend trying this on line 23 and 24
if guiClone then guiClone.Transparency = 1 --Or Something Like this.
*NOTE Make Sure You Define everything in the gui so it all disappears