This regular script makes lighting effects when touched by humanoid, but I need the lighting effects to only affect local player. How can I do that?
local part = script.Parent local function onPartTouched(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if humanoid then game.Lighting.ColorCorrection.TintColor = Color3.new(1, 1, 0) game.Lighting.Blur.Size = 7 game.Lighting.ColorCorrection.Brightness = 0.1 end end part.Touched:Connect(onPartTouched)
Use a RemoteEvent, and handle the client-side lighting effects from the client.
Script (as child of part)
local part = script.Parent local event = -- location of RemoteEvent local function onPartTouched(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if humanoid then event:FireClient(game.Players:GetPlayerFromCharacter(humanoid.Parent)) end end part.Touched:Connect(onPartTouched)
LocalScript
local event = -- location of the same RemoteEvent local function onPartTouched() game.Lighting.ColorCorrection.TintColor = Color3.new(1, 1, 0) game.Lighting.Blur.Size = 7 game.Lighting.ColorCorrection.Brightness = 0.1 end event.OnClientEvent:Connect(onPartTouched)