I have a lot of shields in my game and I don’t know how to make it where you can color any shield instead of having to put each individual name in the color changer script.
Script
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
local humanoid = character:WaitForChild("Humanoid")
local event = game.ReplicatedStorage.RemoteEvents.changeColor
for _,v in ipairs(script.Parent.ShieldC:GetChildren()) do
if v:IsA("ImageButton") then
v.MouseButton1Down:Connect(function()
game.StarterGui.Menu.Sound.Click:Play()
local ColorNeeded = v.BackgroundColor3
if character:FindFirstChild("ShieldModel") then
event:FireServer(ColorNeeded,character.ShieldModel.Main)
end
end)
end
end
for _,v in ipairs(script.Parent.DesignC:GetChildren()) do
if v:IsA("ImageButton") then
v.MouseButton1Down:Connect(function()
game.StarterGui.Menu.Sound.Click:Play()
local ColorNeeded = v.BackgroundColor3
print(v.BackgroundColor3)
if character:FindFirstChild("ShieldModel") then
event:FireServer(ColorNeeded,character.ShieldModel.Main.Shield1)
end
end)
end
end