GUI Button Not Changing Character Colour?

local Player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
	Player.Character.Humanoid.Body.Model.Mushroom.BrickColor = BrickColor.new("Dark blue")
end)

This script is supposed to change my custom character’s colour. it wont work though!

Try this:

script.Parent.MouseButton1Click:Connect(function()
    for i, v in pairs(game:GetService("Players").LocalPlayer.Character:GetDescendants()) do
        if v:IsA("Part") or v:IsA("MeshPart") and not v.Parent:IsA("Tool") then
            v.BrickColor = BrickColor.new("Dark blue")
        end
    end
end)
1 Like

What is the Player value here? There is no arguments for MouseButton1Click so it would always be nil. Even if MouseButton1Click had some arguments, it won’t be player for sure.

1 Like

Put it in starter player > starter player scripts

local player = game.Players.LocalPlayer
local ui = player.PlayerGui.ScreenGui.GUI -- Reference...

ui.MouseButton1Up:Connect(function()
    player.Character.Body.Model.Mushroom.BrickColor = BrickColor.new("Dark blue")
end)
1 Like

Your idea seems to be pointless for me. Why don’t you just use game:GetService("Players").LocalPlayer.Character?

1 Like

This worked! Thank you so much!!!