I'm not exactly sure how to do this or if this script is correct but what I have so far is:
function onKeyDown(key) key:lower() if key == "q" then game.Workspace.E.Transparency = 1 end wait(0.03) end function onKeyUp(key) key:lower() if key == "q" then game.Workspace.E.Transparency = 0 end wait(0.03) end
KeyDown and KeyUp is deprecated, meaning it can be removed or changed at any given moment. So instead of using those, use UserInputService.
Here;
local player=game.Players.LocalPlayer local uis=game:GetService("UserInputService") --The only way to get UIS is by using :GetService uis.InputBegan:connect(function(key) --Same thing as doing mouse.KeyDown, except it's InputBegan if key.KeyCode==Enum.KeyCode.Q then --Q can be any letter (and special keys, like ALT) workspace.E.Transparency=1 --doing workspace is the same as game.Workspace, just less typing end end) uis.InputEnded:connect(function(key) --same thing as mouse.KeyUp if key.KeyCode==Enum.KeyCode.Q then --Same thing workspace.E.Transparency=0 end end)
Put this in either StarterPack or StarterGui
local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() --Did you define player? Mouse.KeyDown:connect(function(Key) Key:lower() if Key == "q" then game.Workspace.E.Transparency = 1 end end Mouse.KeyUp:connect(function(Key) Key:lower() if Key == "q" then game.Workspace.E.Transparency = 0 end end