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

local script cannot find mailbox although mailbox does exist?

Asked by 3 years ago

I am trying to make a special way to transfer data between scripts! like a postal service. the problem is 2 local scripts are having the same error, they can't find a folder named mailbox. both scripts and folder are in playergui. so I added a screen gui! to test if that would fix it. surprisingly the 2 local scripts could not find the screen gui I added!

script 1 error on line 5

01---shortcuts
02local GLI = script.Parent.graphical_load_indicator
03local black = script.Parent.black_screen
04local random = Random.new()
05local local_mail_box = script.Parent.Parent.mail_box
06local new_mail_1 = Instance.new("StringValue", local_mail_box)
07local new_mail_2 = Instance.new("StringValue", local_mail_box)
08 
09---set black's transpaerency to 1
10black.Transparency = 0
11print("gradient is invisble")
12 
13---loop until black screen's transparency is 1
14repeat
15    wait(math.random(1, 10))
View all 34 lines...

script 2 error on line 2

01---shortcuts
02local mail_box = script.Parent.Parent.mail_box
03local mail = mail_box:GetChildren()
04local mail_man = script
05 
06    ---delivery process
07    function delivery(mail)
08 
09    ---carry all mail to post station (aka mail man's truck)
10    mail.Parent = mail_man
11 
12    ---find out who it goes to
13 
14 
15    ---deliver the mail
16 
17end
18 
19---check for mail
20mail_box.ChildAdded:Connect(delivery)

they both get this specific message: mail_box is not a valid member of PlayerGui "Players.jeremqpmfpi.PlayerGui" - Client

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

maybe do

1local Player = game.Players.LocalPlayer
2local Mailbox =  Player.PlayerGui:WaitForChild("mail_box")

instead

0
if it doesn't work maybe its because the mailbox is in a screenGui instead Verbalase_notreal 23 — 3y
Ad

Answer this question