Why the code giving me an error or yield

So my shop script gives me an error . I tried to write FindFirstChild() or WaitForChild() but it also gave me yield for some reason


My folder is already on server storage somehow i dont know why it is giving me the error
(78)
The code that i wrote in the script

function loadbuttontools()
	local frame = script.Parent.ObjectFrame.ViewingFrame:FindFirstChildOfClass("ScrollingFrame")
	wait(0.01) -- to prevent some bugs
	if frame then
		local tools2 = ServerS.Tools:FindFirstChild(frame.Name):GetChildren()
	    local tb = script.Item:Clone()
		tb.Parent = frame.Items
		tb.ItemName.Text = tools2.Name
		tb.Image.Image = tools2.TextureId
	end
end
1 Like

LocalScript cannot access ServerStorage.

4 Likes

LocalScript cannot access ServerStorage.

The solution would be to move the Tools folder to ReplicatedStorage. ReplicatedStorage can be accessed by both local and server scripts.

ServerStorage is for server scripts only.

For now i understand why theres an error, thank you for @Pza12TH and @Sleazel for explaining the problem

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.