Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

ScreenGUI not visible after being cloned?

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:

https://imgur.com/a/akyBbob

Thanks!

1 answer

✓ Accepted answer
newGui.Parent = player.PlayerGui

StarterGui only serves to copy whatever's in there into the PlayerGui every time the player respawns, so if you wanna have things show up to the player's immediate gui try parenting to the player's PlayerGui instead

This discussion is preserved as it was. New answers, comments, and votes are closed.