Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Alarm System colours not working?

Asked by 5 years ago
Edited 5 years ago

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.

0
Use Scripts instead of LocalScripts, it should work. iagometroid 61 — 5y
0
ok HeadlessGuide 16 — 5y
0
Thank you, its solved now. HeadlessGuide 16 — 5y
0
i gave more information about that issue, please accept it as an answer. Thanks iagometroid 61 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

0
Thanks :) HeadlessGuide 16 — 5y
Ad

Answer this question