Hello! So recently I've been editing all of my tools for an upcoming model pack I am making. I decided to make a wallet functional. So basically when I activate the tool, a rupee comes out of it. (Yes this is form zelda) The rupee is a group of parts so it is a model. I am trying to change the model colour to Bright red, but it doesn't seem to do anything at all. it creates the model but does not change the colour. Also there is nothing in the output so I have no idea whats wrong
Tool.Activated:connect(function() SlashAnimLoaded:Play() local assetId = 248897250 Asset = game:GetService("InsertService"):LoadAsset(assetId) A = Asset.RG:GetChildren() A.BrickColor = BrickColor.new("Bright Red")--This is where it doesn't do what it is supposed to. Asset.Parent = game.Workspace Asset.RG:MoveTo(Tool.Handle.Position) end)
Thats where the pairs
come in handy, example:
local b=workspace:GetChildren() for i,v in pairs(b) do if v.className=="Part" then print("part_") end
NOTE: Take note that GetChildren() does not Modify any of the Children it is only used to Gather the Children.
you can read more off here: link
EDITED:
Tool.Activated:connect(function() SlashAnimLoaded:Play() local assetId = 248897250 Asset = game:GetService("InsertService"):LoadAsset(assetId) A = Asset.RG:GetChildren() for i,v in pairs(A) do if v.className=="Part" then v.BrickColor = BrickColor.new("Bright Red") Asset.Parent = game.Workspace Asset.RG:MoveTo(Tool.Handle.Position) end end end)