Hi, here is the script, it keeps giving me an error but the script works.
Workspace.Mushroom.Script:6: attempt to index nil with ‘Mushrooms’
local touchRamen = script.Parent.grabMushroom
local db = false
local function grabRamen(hit)
if hit.Parent.Name == "Ramen" then
local ramenParts = hit.Parent:FindFirstChild("Handle").Mushrooms
ramenParts.Transparency = 0
for i, RamenParts in pairs(ramenParts:GetChildren()) do
RamenParts.Transparency = 0
hit.Parent.Name = "Ramen with Mushrooms"
wait(1)
db = true
wait(10)
db = false
end
end
end
touchRamen.Touched:Connect(grabRamen)
:FindFirstChild is basically just a dot operator except it won’t error itself when you’re indexing for an unknown object. The object Handle is not guaranteed and the function might return nil instead, which is what’s happening here. Consider using :WaitForChild instead or put the function onto a separate line to have more control over it.
Then it’s because the object literally doesn’t exist or maybe there’s a spelling error? Check the explorer to see for yourself if the object is really there