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

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

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)

2 comments

0

Wdym by grayscale? Everything will turn gray for the local player? And how long will it be gray for then?

0

Everything will turn gray for the local player, and only for a split second.

1 answer

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)

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