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

How do I grayscale the screen when a script is successfully executed?

Asked by 3 years ago

I have a script (that was from a question I asked a couple minutes ago) that teleports the player to the location of the cursor. How do I add a lighting effect (specifically grayscale) when this script is successfully executed? Here's the script.

local Player = game.Players.LocalPlayer 
local Character = Player.Character or Player.CharacterAdded:Wait() 
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart") 
local UserInputService = game:GetService("UserInputService")
local Mouse = Player:GetMouse()
local LastTeleported = 1


local CoolDown = 5
local Reach = 30

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end 
    if input.KeyCode == Enum.KeyCode.V and Mouse.Target then 
        local Pos = Mouse.Hit.p
        local Distance = (Pos - HumanoidRootPart.Position).magnitude
        if Distance <= Reach and tick() - LastTeleported >= CoolDown then 
            LastTeleported = tick()
            Character:MoveTo ( Pos )
        end
    end
end)
0
Wdym by grayscale? Everything will turn gray for the local player? And how long will it be gray for then? Techyfied 114 — 3y
0
Everything will turn gray for the local player, and only for a split second. Sikeking66 9 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

To create a grayscale effect you can simply add a color correction effect that has saturation on -1, then toggle it on and off when you teleport, like so:

-- Creating the effect

local effect = Instance.new("ColorCorrectionEffect")
effect.Name = "Grayscale"
effect.Parent = game.Lighting
effect.Saturation = -1
effect.Enabled = false

-- Then toggling it for an instant teleportation

effect.Enabled = true
delay(0.2,function()
    effect.Enabled = false
end)
Ad

Answer this question