Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] Alarm System colours not working?

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.

4 comments

0

Use Scripts instead of LocalScripts, it should work.

0

ok

0

Thank you, its solved now.

0

i gave more information about that issue, please accept it as an answer. Thanks

1 answer

✓ Accepted answer

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

1 comment

0

Thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.