Thank you for reading

local Part = game.Workspace.Part
local holdingUKey = false
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(inputObject) 
	if(inputObject.KeyCode==Enum.KeyCode.E)then
		holdingUKey = true
		while holdingUKey do
			Part.CFrame = Part.CFrame + Part.Orientation.Y*1
			wait(0.01)
		end

	end
end)
UIS.InputEnded:Connect(function(inputObject)
	if(inputObject.KeyCode==Enum.KeyCode.E)then
		holdingUKey = false
	end
end)

5 comments

0

You should include any errors.

0

I think it's better if you multiply CFrame.Angles(x,y,z) by Board.CFrame (in that order). What you're trying to do on line 08 doesn't make sense.

0

invalid argument #1 (CFrame expected, got function) - Client - LocalScript:13

0

Thank You Radiant_Light it worked!

0

But its doing full 360s for me