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

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

Asked by
Stravan 18
6 years ago
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.

0
LocalScript ? LordTechet 53 — 6y
0
If you do it in a LocalScript with FilteringEnabled, it will only occur for the client. mattscy 3725 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

0
This is a localscript and filtering is enabled, it still occurs globally. Stravan 18 — 6y
Ad

Answer this question