For some reason, the ColorCorrectEffect which I've named ''Sharingan" only turns on (enables) if I'm holding "u", if I let go of the Key "u" the ColorCorrectEffect turns off (disables) which is something I don't want, it's only supposed to disable if I press "u" again after I've already pressed "u" to enable it. Any help?
Script:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local Humanoid = player.Character:FindFirstChild('Humanoid') local sharingan = game.Lighting.Sharingan mouse.KeyDown:Connect(function(Key) if Key == "q" then sharingan.Enabled = true Humanoid.WalkSpeed = 20 end end) mouse.KeyUp:Connect(function(Key) if Key == "q" then sharingan.Enabled = false Humanoid.WalkSpeed = 16 end end)
Simple invert the Enabled
property of the ColorCorrectionEffect upon pressing the key by using not
. Also use UserInputService instead of Mouse.
local player = game.Players.LocalPlayer local Humanoid = player.Character:FindFirstChild('Humanoid') local sharingan = game.Lighting.Sharingan game:GetService("UserInputService").InputBegan:Connect(function(iobj, gp) if gp then return --exit if they are typing in a textbox or such end if iobj.KeyCode == Enum.KeyCode.U then sharingan.Enabled = not sharingan.Enabled --see? like this end end)