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)
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)