I am making a loop to continuosly move something to the mouse's position:
local move=true local mouse=game.Players.LocalPlayer:GetMouse() local part=workspace.TEST while move do part.CFrame=mouse.hit wait(math.huge) --jk end
however, im trying to add in a r key pressed to find out when to rotate the brick.
local move=true local mouse=game.Players.LocalPlayer:GetMouse() local part=workspace.TEST while move do part.CFrame=mouse.hit UserInputService.InputBegan:connect(function(input,gameProcessed) if input.UserInputType == Enum.UserInputType.Keyboard then local keyPressed = input.KeyCode if keyPressed==(Enum.KeyCode.R) then print("hi") end end end end) wait(math.huge) --jk end
when i run the script, however, this happens:
hi
hi
hi
hi
hi
hi
if anyone could help me that would be much appreciated