Note
For client entity scripts, the URL content must be available to every user who visits the domain. This means the URL should be a public http(s) URL, or an Asset Server (ATP) URL for the domain. It cannot be a file URL. The script property also accepts a string as input, allowing you to insert the code directly.
## Example of a Client Entity Script
The following script changes the color of a non-model entity (such as a box or a sphere) when you click on it:
```javascript
(function () {
var clicked = false;
this.clickDownOnEntity = function (entityID, mouseEvent) {
if (clicked){
Entities.editEntity(entityID, { color: { red: 0, green: 255, blue: 255} });
clicked = false;
} else {
Entities.editEntity(entityID, { color: { red: 255, green: 255, blue: 0} });
clicked = true;
}
};
})
```
This example is written as a JavaScript class prototype function, and it uses the mouse event [clickDownOnEntity()](https://apidocs.highfidelity.com/Entities.html#.sendClickDownOnEntity). When the user clicks on an entity, `clickDownOnEntity()` triggers the function associated with that click event. In this case, it changes the entity's color back and forth between yellow and magenta.
**See Also**
- [Get Started with Scripting](get-started-with-scripting)
- [Write Your Own Scripts](write-scripts)
- [API Reference](https://apidocs.highfidelity.com)