WaitForChild does NOT work

The issue is that no matter what I do, location where to put the item is not found in the ModuleScript I use to manage shop items.

local sS = game:GetService("ServerStorage")


local module = {
	["Cafeteria"] = {
			BloxyCola = {
				InstName = "BloxyCola",
				DisplayName = "Bloxy Cola", -- Name to Display
				Description = "A refreshing cold drink.",
				Location = sS:WaitForChild("ShopItems"),
				ItemImage = 578766873,
				Price = 10;	
	--["ShadyDealer"] =  

return module

The shop gui:

local shopSys = require(game:GetService("ReplicatedStorage"):WaitForChild("ShopSys"))
local frame = script.Parent
local image = frame:WaitForChild("Image")
local name = frame:WaitForChild("Name")
local desc = frame:WaitForChild("Desc")
local button = frame:WaitForChild("BuyButton")
local PurchaseEvent = game:GetService("ReplicatedStorage").Purchase
local players = game.Players

local instName = shopSys.Cafeteria.BloxyCola.InstName
local ImageID = shopSys.Cafeteria.BloxyCola.ItemImage
local NameText = shopSys.Cafeteria.BloxyCola.DisplayName
local DescText = shopSys.Cafeteria.BloxyCola.Description
local price = shopSys.Cafeteria.BloxyCola.Price
local loc = shopSys.Cafeteria.BloxyCola.Location

image.Image = ("rbxassetid://"..ImageID)
name.Text = NameText
desc.Text = DescText

	local result = players.LocalPlayer:FindFirstChild("leaderstats"):WaitForChild("Flux").Value >= price

I’m growing desperate…


Infinite yield possible on 'ServerStorage:WaitForChild("ShopItems")'

I’m assuming this is a LocalScript? The client cannot access ServerStorage or ServerScriptService.

this is bad very bad please change to game:GetService("Players")
it’s more reliable and nicer to look at

1 Like

That has been answered by a friend already! Also, thanks.

Appreciate your help though.

1 Like

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