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

Is there a way for this script to only occur to the local player?

local b = game.Lighting.ColorCorrection
local plr = game.Players.LocalPlayer
local ui = plr:WaitForChild("PlayerGui")
local vig = ui:WaitForChild("ScreenGui"):WaitForChild("Frame"):WaitForChild("ImageLabel")

local check = 0

function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
    if player then
		game.StarterPack.Sound.TimePosition = 4
		game.StarterPack.Sound:Play()
		wait(0.001)
		plr.Backpack.Sound:Destroy()
		check = check + 1
		if check == 1 then
			for i = 0.02,1.5,0.05 do
				b.Brightness = i
				vig.ImageTransparency = i
			wait(0.01)
			end
		end
    end
end

game.Workspace.UniTele1.Touched:connect(onTouched)

When I test this code with 2 players, the brightness changes on both ends. I only want this to change on the screen of the person who touched it. I'm not sure what to do.

2 comments

0

LocalScript ?

0

If you do it in a LocalScript with FilteringEnabled, it will only occur for the client.

1 answer

Try putting it on a LocalScript. And make sure filtering is enabled.

1 comment

0

This is a localscript and filtering is enabled, it still occurs globally.

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