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

What kind of error is the output telling me?

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

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)

2 comments

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

0

It still didn't work, though.

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.

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