I need to play an animation, resize a mesh, and activate a bodyForce object for as long as the player holds down the spacebar, and then turn them off and resize the mesh again as soon as they lift it up.
How would I check for that?
This was my first thought:
k = {}
mouse.KeyDown:connect(function(b) k[b] = true end)
mouse.KeyUp :connect(function(b) k[b] = nil end)
while wait() do
if k[Enum.KeyCode.Space] then
--blahghblah
end
if k[Enum.KeyCode.Space]==nil then
--blaghblah
end
But, well, it doesn't work, and I don't really want to use a loop for this.

2 comments
Well first, don't use KeyDown/KeyUp because it's deprecated. Also, you're not checking if it's the Spacebar that's being pressed. Also, on line 4, you should be setting k[b] to false, not nil. You also don't need a loop.
'nil' also works too...