I'm making an Alarm system for a game I'm working on. When the player touches a laser beam being emitted from a sentry camera and is spotted the alarms part should change the colour to Bright Red. I don't know whats going wrong with my local script and there aren't any errors printed out. Code:
function onTouch(hit) script.Parent.BrickColor = BrickColor.new("Really red") end script.Parent.Touched:connect(onTouch)
Please help me with this issue. Thank you in advance.
I will tell you why the part after touched the color doen't change it is because of the script type:
Script: This runs Server-Sided, (On The Server). This uses Server-Sided events and properties. When you make a script on a Script type, will run for all players.
LocalScript: This runs Client-Sided, (Only for you). This uses Client-Sided (only for you) events and properties such as getting the player with game.Players.LocalPlayer
to get Mouse or Camera and individual stuff like that.
If you want to make a change using local scripts for all players to see it, you always need to use Remote Events for more details of Remotes Events: https://developer.roblox.com/api-reference/class/RemoteEvent