How work localscript for brickcolor

Here are two sources to help you out:
Documentation:

A LocalScript will only run Lua code if it is a descendant of one of the following objects:

  • A Player’s Backpack , such as a child of a Tool
  • A Player’s character model
  • A Player’s PlayerGui
  • A Player’s PlayerScripts .
  • The ReplicatedFirst service

Therefore put it in player starter scripts to make it run once then do workspace:WaitForChild(“TouchPart”) or use game.IsLoaded to get the part (wait for the stuff in workspace to load first, then do the touched event).

You will also need to make sure the person who triggered Touched event is the local player as well because physics replicate and avoid this issue:

1 Like