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

What kind of error is the output telling me?

Asked by 8 years ago

I'm trying to get where, when you click the blue circle on the popup GUI, your Suitcase (named handle) turns to a blue color. The output says this:

07:35:09.225 - Players.Player.PlayerGui.Magazine.Frame.Blue.Color script:8: attempt to index field 'Parent' (a nil value)

Here's the code:

local player = game.Players.LocalPlayer
local bag = player.Backpack:WaitForChild("Suitcase"):WaitForChild("Handle")

function onClick()
    bag.BrickColor = BrickColor.new("Bright blue")
end

script.Parent.MouseButton1Click:connect(onClick)

Here are some screenshots of the project:

1) http://prntscr.com/abvzth

2) http://prntscr.com/abvzzk

3) http://prntscr.com/abw048

2 answers

Log in to vote
0
Answered by 8 years ago
local player = game.Players.LocalPlayer
local bag = player.Backpack:WaitForChild("Suitcase")
local Handle = player.Backpack.Suitcase:WaitForChild("Handle")

script.Parent.MouseButton1Click:connect(function()
    Handle .BrickColor = BrickColor.new("Bright blue")
end)

0
Yes you've given him the solution to his question but you've not explained what you've done and why you done it... Doesn't help people learn Uroxus 350 — 8y
0
It still didn't work, though. VirtualFlying 55 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

The problem here is where you're searching. Since you want the suitcase to turn blue, I'm sure you want the player(s) to notice it, hence the suitcase being equipped.

You're searching in their backpack, not their character.

Answer this question