Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Keep getting "is not a valid member of workspace" while it is really in here?

So, i have a script that's inside StarterPlayerScript that creates folders inside WORKSPACE. (LocalScript)

All of my scripts are able to reach a folder that's created when a player joins. The foldername is PlayerInfo.

However, i'm scripting another script that's going to be in a model in WORKSPACE, that has to reach PlayerInfo.

The following script has to reach it: (normale script, also tried Local)

wait()

PlayerInfo = workspace.PlayerInfo

wait()

  

while true do

wait()

if workspace.PlayerInfo.Mode == "Medium" then

script.Parent.Slow:Destroy()

script:Destroy()

print("Slow Destroyed")

elseif workspace.PlayerInfo.Mode == "Slow" or "Hard" then

script.Parent.Medium:Destroy()

script:Destroy()

print("Medium Destroyed")

end

end

The script only will be enabled if PLAYERINFO EXCIST!

And yes, the script will be enabled. So, PlayerInfo does excist. I've checked in play-mode, and it excist.

HOWEVER<

The script above gives me this freaking error:

   PlayerInfo is not a valid member of Workspace

like, wtf. Every script that i wrote says it's here. But this cunt won't find it?

I've tried :WaitForChild, :FindFirstChild and so on.

All keep saying it does not excist! WHILE IT EXCIST!

Anyone who can help me. This is driving me crazy!

2 comments

0

"excist", ok first of your your spelling sucks, second of all your indentation makes me want to go commit oof, learn to indent otherwise you will never be successful at lua

0

to be fair when pasting your code onto the site it doesn't keep your indention lol

2 answers

try this before the line if workspace.PlayerInfo.Mode == "Medium" then insert if workspace:FindFirstChild("PlayerInfo") then and put an extra end, this will check if playerinfo exists and then do the next lineso the code should look like this

  while true do
    
    wait()
    if workspace:FindFirstChild("PlayerInfo") then
    
    if workspace.PlayerInfo.Mode == "Medium" then
    
    script.Parent.Slow:Destroy()
    
    script:Destroy()
    
    print("Slow Destroyed")
    
    elseif workspace.PlayerInfo.Mode == "Slow" or "Hard" then
    
    script.Parent.Medium:Destroy()
    
    script:Destroy()
    
    print("Medium Destroyed")
    
    end
    
    end
    
    end

3 comments

0

Doesn't work...

0

Doesn't work... I added an print if it's found. But it prints nothing. Still thinking PlayerInfo does not excist. I

0

u sure u typed it correctly?

COOL! SO I DECIDED TO MOVE PLAYERINFO TO BACKPACK...

Same stuff. Backpack is not a valid member of Player...

local player = game.Players.LocalPlayer
ReadyFolder = Instance.new("Folder")

ReadyFolder.Parent = player.Backpack

ReadyFolder.Name = "PlayerInfo"

4 comments

0

i assume this is a local script, try use game:GetService("Players").LocalPlayer instead

0

and u need to do local ReadyFolder = Instance.new("Folder")

1

Watch the language, please.

0

language boooi, this site has users less then the age of 18

This discussion is preserved as it was. New answers, comments, and votes are closed.