How to change a parts colour in a local script?

Hello! I have been looking around the internet for ways to change a parts colour in a local script, or atleast change it for only the player. I am now stuck wondering if this is even possible. If you know anything regarding this, please help me out. Thank you!

1 Like

Local script:

local Brick = workspace.Part

Brick.BrickColor = BrickColor.New("Red")

I have tried this prior to this reply but it didn’t work… do you have any other idea to how this is done? Or is my setup completely flawed somehow?

Could I see the script or doesn’t you have any scripts right now?

Local scripts in workspace or some other services do not run by default. You should move those to StarterPlayerScripts or to a tool or change the RunContext of the script.

I have a script, yes, and here it is:

local plr = game:GetService("Players").LocalPlayer
local Button = script.Parent
local CashValue = plr:WaitForChild("CashValue")

while true do
	if CashValue >= 10 then
		Button.BrickColor = BrickColor.new("Lime green")
	else
		Button.BrickColor = BrickColor.new("Persimmon")
	end
	wait(0.1)
end

Try moving the script as Aerodymier said

ty man! this rly helped and will hopefully help others in future!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.