local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent script.Parent.MouseButton1Click:connect(function(click) local plrName = plr.Name local Workspace = game.Workspace local cartName = plrName..Cart local cart = Workspace..cartName for i,v in pairs (cart:GetChildren()) do if v.Name == "Changable" then v.Color = BrickColor.new(script.Parent.Name) end end end)
I'm trying to get a script that I won't have to customize to work with other colors*
I have a color palette gui and now I'm trying to get the buttons to color parts in workspace the color of their name? I hope its possible because I've tried having one script to do it all but I would have to have it be HUGE with every single color which I'm trying to avoid. Please help xD
There are so many wrong things in this script, unfortunately. ):
--Problem 1 local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent --Suggested to use a LocalScript in the TextButton so you can use: local plr = Game.Players.LocalPlayer --Problem 2 script.Parent.MouseButton1Click:connect(function(click) --"click" isn't really needed, Suggestion: script.Parent.MouseButton1Click:connect(function() --Problem 3 local Workspace = game.Workspace --Not needed, just chill and use "Workspace", nothing else. --Problem 4 --You can't use plr.Name to put bricks in.. As plr.Name is a string value... --Problem 5 local cartName = plrName..Cart local cart = Workspace..cartName --Why are you using concatenations on a value? That's only for strings, bro. --Correction: local cartName = plrName.Cart local cart = Workspace.cartName --Still, it's really confusing, I don't know what you're trying to do here, the name of these values --Problem 6 v.Color = BrickColor.new(script.Parent.Name) --According to the brick's properties, in the studio property window, it's: v.BrickColor = BrickColor.new(script.Parent.Name)
If you have questions, ask me, but I think you should go back to basics, you're missing a lot of scripting basic lessons, you just can't script something like that if you don't know the basics and use them properly.