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

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

Asked by 5 years ago

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!

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 LoganboyInCO 150 — 5y
0
to be fair when pasting your code onto the site it doesn't keep your indention lol AnonymousDeveloper13 22 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
Doesn't work... HeadlessDeathSpeaker 9 — 5y
0
Doesn't work... I added an print if it's found. But it prints nothing. Still thinking PlayerInfo does not excist. I HeadlessDeathSpeaker 9 — 5y
0
u sure u typed it correctly? Gameplayer365247v2 1055 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited by M39a9am3R 4 years ago

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"
0
i assume this is a local script, try use game:GetService("Players").LocalPlayer instead Gameplayer365247v2 1055 — 5y
0
and u need to do local ReadyFolder = Instance.new("Folder") Gameplayer365247v2 1055 — 5y
1
Watch the language, please. DeceptiveCaster 3761 — 5y
0
language boooi, this site has users less then the age of 18 LoganboyInCO 150 — 5y

Answer this question