Code wont locate a local script

Hello! so i made a local script that is suposed to define “gui”, gui is located in the same folder as the script , so im doing , local gui = script.Parent:WaitForChild(“GUIScript”) but it say inf yield possible, if i dont put wait for child it just say it does not exist, but thats false, look

1 Like

I guess it’s going to be better if you first define the folder variable then define the gui

ill try that , but im not sure that it will work, it should rn

still not working, with defined folder

one more thing you want to get the gui or the script only?

1 Like

the gui, but it block on the script

this script Should Find The Gui for you without problem

for i,v in pairs(script.Parent:GetChildren()) do
	if v:IsA("LocalScript") then
		if v.Name == "GUIscript" then
			local GUI = v:FindFirstChild("GUI")
		end
	end
end
1 Like

alright, trying this code to see…

you can add a print() function after this line so it would be easier to findout

1 Like

its working now the thing is now it blocks on everything now , but it works on another script that is literally the same one

just replcae the ends to the end of your script

1 Like

no like, your block of code is working, but now my code isnt able to locate (everything)

oh, can you record a video or take a screen shot?

1 Like

sure, ill take a gyzao and link it

1 Like

Looking at your code it seems you did this

local gui = script.Parent.WaitForChild("GUIScript")

whereas it should be a colon

local gui = script.Parent:WaitForChild("GUIScript")

so see, in it we can see that i can reload the small gun but not the big one
https://gyazo.com/2e4017bd56209c9024ba16f64b954af7

1 Like

If he did this one wrong he shouldn’t even get infinite yield in output

No just a typo on the picture, it say infinite yield

1 Like

hmm, is the script of the big gun is inside that local script or the one that you had the problem?

The one that is not working is the SKS (big gun)

1 Like