Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why am i getting an error, I don't get it. It just says not a valid member?? (FIXED)

Asked by 4 years ago
Edited 4 years ago

Code:

local rem = game.ReplicatedStorage.RemoteEV.BreakGlassHammer
local particle = workspace.Small_House.GlassOne.ParticleEmitter
local Shatter = game.ReplicatedStorage.GlassOne.Shatter
local Glass = workspace.Small_House:WaitForChild("GlassOne")
local rem = game.ReplicatedStorage.RemoteEV:WaitForChild("BreakGlassHammer")
local sound = workspace.Small_House.GlassOne.Glass_Break


rem.OnServerEvent:Connect(function(player)
            wait(0.1)
        sound:Play()
                particle.Enabled = true
        wait(0.2)
        particle.Enabled = false
        Shatter.Parent = workspace
        Shatter.Anchored = true
        Glass.Parent = game.ReplicatedStorage.GlassOne
        wait(70)
        Shatter.Parent = game.ReplicatedStorage.GlassOne
        Glass.Parent = workspace
    end)

Output:

17:28:12.080 - GlassOne is not a valid member of Folder 17:28:12.081 - Stack Begin 17:28:12.081 - Script 'ServerScriptService.Glass_One_Has_Hammer', Line 2

It is under the folder Small_House on other codes, there is also the exact same problem or am I just dum

Fix/Conclusion So it's actually a glitch in Roblox studio that you cant sometimes access something in a folder? I just moved it into workspace outside of the folder an now it works when I access it.

0
try using `WaitForChild()` lo_ar -52 — 4y
0
WaitForChild() with a timeout ^. You can use a timeout to prevent infinite yield. DeceptiveCaster 3761 — 4y
0
Already did that a while back while trying to fix it. :p Freddan2006YT 88 — 4y

Answer this question