Create a LocalScript in StarterPlayerScripts (so it will only run once when the player joins the game rather than every time they respawn).
You will need to get the path to the brick you want to listen to Touched events for, and then setup the event. When something touches that part, you simply want to know if its parent is the local player's character. If so, then run the code you want.
local Lighting = game.Lighting
local localPlayer = game.Players.LocalPlayer
workspace.ModelNameHere.PartNameHere.Touched:Connect(function(p)
if p.Parent ~= localPlayer.Character then return end
Lighting.Ambient = Color3.new(0,0,0)
Lighting.ShadowColor = Color3.new(0,0,0)
end)
(Obviously replace ModelNameHere.PartNameHere with the path to the part.)
(The purpose of local Lighting = game.Lighting was just so you don't have to say game.Lighting over and over again - it's faster for you to type in and for Roblox to run.)
You can extend this script with more Touched connections to handle other lighting changes as well.
If you wanted the lighting to reset every time the character respawned, you'd probably want to put this LocalScript in StarterCharacterScripts instead and to change the Lighting near the beginning of the script (outside of any Touched event listeners).
2 comments
Not sure if this is the website for this.
what do you THINK this websites for?