✓ Accepted answer
You ALMOST had it! Your only problems were that you weren't using a LocalScript, never got the mouse, never lower-cased key (We do that so that we only have to check for 'q', and not 'Q' as well) and you forgot to wrap q in quotation marks to make it a string. Here's the fixed version:
local tile = game.Workspace.Tile
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "q" then
tile.ClickDetector.MaxActivationDistance = 32
end
end)
mouse.KeyUp:connect(function(key)
key = key:lower()
if key == "q" then
tile.ClickDetector.MaxActivationDistance = 0
end
end)