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

FindFirstChild and WaitForChild both doesn't work?

Here we go. I'm creating a Menu GUI and I used the TweenService(?). More of that whenever I use WaitForChild or FindFirstChild on Line 2, both would, regardless, give me a warning and error, respectively. Help would be appreciated.

local btn = script.Parent
local service = game:GetService("ServerStorage")
local gui = service:WaitForChild("Gui")  --Infinite Yield Warning
local guion = false

function TweenGui()
	guion = true
	local newgui = gui:Clone()  --Error for FindFirstChild
	newgui.Parent = script.Parent.Parent.Parent
	local frame = newgui:WaitForChild("Frame")
	frame.Position = UDim2.new(-5,0,.5,0)
	frame:TweenPosition(UDim2.new(0.5,0,0.5,0), "In", "Linear" , 2)
	
	
	
end

function TweenBackGui()
	guion = false
	
	local newgui = script.Parent.Parent.Parent.Parent.PlayerGui.Gui
	
	local frame = newgui:WaitForChild("Frame")
	
	frame:TweenPosition(UDim2.new(-5,0,0.5,0), "In", "Linear" , 2)
	wait(5)
	frame.Parent:Destroy()
	
	
	
end

function GetStatus()
if guion == false then
	TweenGui()
	
	
	
else
	TweenBackGui()
end
	
	
end

script.Parent.MouseButton1Click:Connect(GetStatus)

Thanks!

5 comments

0

Is Gui a child of ServerStorage?

0

Yes.

0

Make sure the gui is correctly named "Gui" or try naming it something else.

0

Will try when I get home

0

After doing some research I noticed that LocalScripts can't access ServerStorage. Problem Solved.

1 answer

when you run the game everything in serverstorage gets deleted. use replicatedstorage

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