So i made a monitor and i have a chair but i want the monitor screen to light up so change the material to neon. So it shows like you would be using the computer. I really have not experimented changing/manipulating parts with scripts before.
local Seat = script.Parent -- The seat local Monitor = PathToMonitor -- Change to where your monitor is Seat:GetPropertyChangedSignal("Occupant"):Connect(function() -- Run the below code when the Occupant changes if Seat.Occupant then -- Checks if someone is sitting in the Seat Monitor.Material = Enum.Material.Neon -- If someone is sitting in the seat else Monitor.Material = Enum.Material.Plastic -- If someone is not sitting in the seat end end)
Don't forget to mark my answer as the solution and upvote it if it solved your problem :)
Assuming it doesn't matter who is in the seat, this could work: (put script in seat)
local monitor = ??? --Make this the location of the monitor script.Parent.Occupant.OnChanged:connect(function() if script.Parent.Occupant == humanoid then monitor.Material = Enum.Material.Neon else monitor.Material = Enum.Material.Plastic --Change this to the default material end end
Hello Tnipo, I have found a solution to your problem.
place the script inside the seat.
Good Luck!
--script is inside seat --get reference to seat local Seat = script.Parent -- get reference to "Occupant" property of seat local Occupant = Seat.Occupant --get reference to screen (your path may differ) local Screen = script.Parent.Parent.Parent.Monitor.Screen --create material variables local Neon = Enum.Material.Neon local SmoothPlastic = Enum.Material.SmoothPlastic --create function to handle the event local function toNeon() if Seat.Occupant then Screen.Material = Neon else Screen.Material =SmoothPlastic end end --fires event Seat:GetPropertyChangedSignal("Occupant"):Connect(toNeon) -- the above line detects when the "Occupant" property of the seat is changed, and then executes the function toNeon()