Hey! I am having trouble with my ScreenGUI not being visible after it is Cloned from ReplicatedStorage, I would like the GUI to be visible when the player is sitting down but for it to be deleted when the player stands up. Here is my code:
local Seat = game.Workspace.Nexus.Nexus:WaitForChild("Seat")
local player = game.Players.LocalPlayer
local gui = game.ReplicatedStorage.ScreenGui
local character = player.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
hum.Seated:Connect(function(hit)
print("Player detected on "..Seat.Parent.Name)
local newGui = gui:Clone()
newGui.Parent = game.StarterGui
newGui.Frame.Active = true
repeat wait() until not player.Character.Humanoid.Sit
print("Player no longer detected on "..Seat.Parent.Name)
wait(0.1)
newGui:Destroy()
end)
And here is what happens:
Thanks!
