Basically, when a player clicks the textlabel specifying what color they'd be choosing it fires the remote, it should go through the weapon that they had equipped and check for all parts, meshparts, and unionoperations. Lastly, change the color of said part, though it's not working?
LOCAL SCRIPT
--[ Client local plr = game.Players.LocalPlayer repeat wait() until plr.Character local char = plr.Character local hum = char:WaitForChild('Humanoid') --[ User Interface local Buttons = script.Parent local Red = Buttons:WaitForChild('Red') local Black = Buttons:WaitForChild('Black') local Pink = Buttons:WaitForChild('Pink') local White = Buttons:WaitForChild('White') local Green = Buttons:WaitForChild('Green') --[ Children local Remote = script:WaitForChild('RemoteEvent') local UI = script.Parent.Parent.Parent local Main = UI:WaitForChild('Main') local Mods = UI:WaitForChild('Mods') --[ Variables local debounce = false local color = nil local function touchgreen() if not debounce then debounce = true color = 'green' for _, v in pairs(char:GetChildren()) do if v:IsA('Tool') then Remote:FireServer(color, v) end end Mods.Visible = false Main.Visible = true end wait(10) debounce = false end local function touchred() if not debounce then debounce = true color = 'red' for _, v in pairs(char:GetChildren()) do if v:IsA('Tool') then Remote:FireServer(color, v) end end Mods.Visible = false Main.Visible = true end wait(10) debounce = false end local function touchblack() if not debounce then debounce = true color = 'black' for _, v in pairs(char:GetChildren()) do if v:IsA('Tool') then Remote:FireServer(color, v) end end Mods.Visible = false Main.Visible = true end wait(10) debounce = false end local function touchpink() if not debounce then debounce = true color = 'pink' for _, v in pairs(char:GetChildren()) do if v:IsA('Tool') then Remote:FireServer(color, v) end end Mods.Visible = false Main.Visible = true end wait(10) debounce = false end local function touchwhite() if not debounce then debounce = true color = 'white' for _, v in pairs(char:GetChildren()) do if v:IsA('Tool') then Remote:FireServer(color, v) end end Mods.Visible = false Main.Visible = true end wait(10) debounce = false end --[ Event Binding Green.MouseButton1Click:Connect(touchgreen) Red.MouseButton1Click:Connect(touchred) Black.MouseButton1Click:Connect(touchblack) Pink.MouseButton1Click:Connect(touchpink) White.MouseButton1Click:Connect(touchwhite)
SERVER SCRIPT
local remote = script.Parent:WaitForChild('RemoteEvent') local function changeskin(player, color, weapon) if not player then return end if not weapon then return end if not player.Character then return end if player.Character.Humanoid.Health <= 0 then return end if color == 'red' then for _, v in pairs(weapon:GetChildren()) do if v:IsA('Part') or v:IsA('MeshPart') or v:IsA('UnionOperation') then v.Color = Color3.fromRGB(203, 0, 0) end end end if color == 'black' then for _, v in pairs(weapon:GetChildren()) do if v:IsA('Part') or v:IsA('MeshPart') or v:IsA('UnionOperation') then v.Color = Color3.fromRGB(0, 0, 0) end end end if color == 'white' then for _, v in pairs(weapon:GetChildren()) do if v:IsA('Part') or v:IsA('MeshPart') or v:IsA('UnionOperation') then v.Color = Color3.fromRGB(255, 245, 255) end end end if color == 'green' then for _, v in pairs(weapon:GetChildren()) do if v:IsA('Part') or v:IsA('MeshPart') or v:IsA('UnionOperation') then v.Color = Color3.fromRGB(121, 255, 111) end end end if color == 'pink' then for _, v in pairs(weapon:GetChildren()) do if v:IsA('Part') or v:IsA('MeshPart') or v:IsA('UnionOperation') then v.Color = Color3.fromRGB(255, 0, 255) end end end end remote.OnServerEvent:Connect(changeskin)