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

PlayerGui not indexable from a HopperBin?

Asked by 11 years ago

I finished writing a headache piece of code, only the find out that line 1 didn't work. I have tried to wrap my head around why it won't work, and the only logical explination I came up with is that PlayerGui can't be indexed from a HopperBin (or the Backpack). Here's the problem code, changed a bit from it's previous version.

1print (script.Parent.Parent.Parent:FindFirstChild("PlayerGui").Name)

The script's is heirarchy is as so: game.Players.Player1.Backpack.Tool(HopperBin, not a Tool).Script

It's as if PlayerGui doesn't exist...

Here's all of the code, if it helps.

01local menu = script.Parent.Parent.Parent.PlayerGui.tahcune
02local selected = menu.selected
03local plr = script.Parent.Parent.Parent
04 
05function onObjectSelected(mouse)
06    local t = Instance.new("Part")
07    t.Anchored = true
08    t.FormFactor = 2
09    t.BottomSurface = "Smooth"
10    t.TopSurface = "Smooth"
11    t.BrickColor = BrickColor.new(Color3.new(0, 0, 0))
12    t.Transparency = 0.65
13    t.Position = mouse.Hit.p
14    t.Size = Vector3.new(selected.Value.info.hoverSize.Value.X, selected.Value.info.hoverSize.Value.Y / 2, selected.Value.info.hoverSize.Value.Z)
15    t.Parent = game.Workspace
View all 48 lines...

1 answer

Log in to vote
1
Answered by
Dummiez 360 Moderation Voter
11 years ago

Since you're running this from a HopperBin, and accepts LocalScripts as the only way to execute, you could rather parenting getting LocalPlayer, also I don't understand why you are naming PlayerGui when you are already getting the name?

Getting your player:

local plr = game.Players.LocalPlayer

Finding the PlayerGui:

print(plr.PlayerGui.Name)

EDIT: I think it works anyways.. lol

0
I see what you're getting at, but I need to be able to access ServerStorage with the script, and LocalScripts can't cheweydog 20 — 11y
0
How can your code access ServerStorage then? Running ServerScripts can't work on HopperBin as it was disabled because of exploits. Dummiez 360 — 11y
0
Crud. I forgot to test this in a live game. Thanks, I'll rewrite to work from a tool! cheweydog 20 — 11y
Ad

Answer this question