i want to make brick named "cam" move when im still pressing key, not only when im pressed it but i getting error when im using InputEnded, what can i do?
UIS.InputBegan:Connect(function(key, gp)
if key.KeyCode == HK then
repeat wait(.1) move(key) until UIS.InputEnded()
elseif key.KeyCode == HK2 then
repeat wait(.1) move(key) until UIS.InputEnded()
end
end)
function move(key)
print(camera.Position.Y)
if key.KeyCode == HK then
if check() == true then
local newpos = camera.Position.Y + 1
camera.Position = Vector3.new(camera.Position.X,newpos, camera.Position.Z)
end
end
if key.KeyCode == HK2 then
if check2() == true then
local newpos = camera.Position.Y - 1
camera.Position = Vector3.new(camera.Position.X,newpos, camera.Position.Z)
end
end
end
function check()
if camera.Position.Y < 221 then
return true
elseif camera.Position.Y == 221 then
return end
end
function check2()
if camera.CFrame.Y > 34 then
return true
elseif camera.Position.Y == 34 then
return end
end
