I have a problem with ReplicatedStorage. I am storing a bunch of MeshParts but whenever I try to access them they just show up as nil.
Here is my code:
local module = {}
local rep = game:GetService("ReplicatedStorage")
local numbers = rep:WaitForChild("Numbers"):GetChildren()
-- 10746979335
function module.charToMeshPart(char)
local ascii = string.byte(char)
local thing = numbers["ASCII"..tostring(ascii)] or numbers["ERR"]
if not thing then
warn("No mesh found")
warn("NAME: ".."ASCII"..tostring(ascii))
end
print(thing)
return thing
end
local numbers = rep:WaitForChild(“Numbers”):GetChildren()
numbers becomes a table
.
numbers[“ASCII”…tostring(ascii)]
You attempt to access numbers as though it was a dictionary.
Try removing GetChildren() when defining numbers, as well as switching from numbers[“… to numbers:FindFirstChild(”…, and see if it resolves your issue
local module = {}
local rep = game:GetService("ReplicatedStorage")
local numbers = rep:WaitForChild("Numbers")
function module.charToMeshPart(char)
local ascii = string.byte(char)
local thing = numbers:WaitForChild("ASCII"..tostring(ascii), 5) or numbers:FindFirstChild("ERR")
if not thing then
warn("No mesh found")
warn("NAME: ".."ASCII"..tostring(ascii))
end
print(thing)
return thing
end
Turns out in another part of the script I was calling that function and then using that result and parenting it somewhere else instead of cloning it first, so the next time it was accessed it wasn’t there.